def HTTPInfoFromException(value):
 if isinstance(value, web.HTTPError):
  return (value.status_code, value.log_message)
 elif isinstance(value, InvalidRequestError):
  return (400, value.args[0])
 elif isinstance(value, HttpForbiddenError):
  return (403, value.args[0])
 elif isinstance(value, NotFoundError):
  return (404, value.args[0])
 elif isinstance(value, ServiceUnavailableError):
  return (503, value.args[0])
 else:
  return (500, str(value))

def HTTPInfoFromException ( value ) : if isinstance ( value , web . HTTPError ) : return ( value . status_code , value . log_message ) elif isinstance ( value , InvalidRequestError ) : return ( 400 , value . args [ 0 ] ) elif isinstance ( value , HttpForbiddenError ) : return ( 403 , value . args [ 0 ] ) elif isinstance ( value , NotFoundError ) : return ( 404 , value . args [ 0 ] ) elif isinstance ( value , ServiceUnavailableError ) : return ( 503 , value . args [ 0 ] ) else : return ( 500 , str ( value ) )
returns a tuple containing the http status code and error message .