def error_from_response(message, http_response, error_class, response_body=None):
 if (response_body is None):
  body = http_response.read()
 else:
  body = response_body
 error = error_class(('%s: %i, %s' % (message, http_response.status, body)))
 error.status = http_response.status
 error.reason = http_response.reason
 error.body = body
 error.headers = atom.http_core.get_headers(http_response)
 return error

def error_from_response ( message , http_response , error_class , response_body = None ) : if ( response_body is None ) : body = http_response . read ( ) else : body = response_body error = error_class ( ( '%s: %i, %s' % ( message , http_response . status , body ) ) ) error . status = http_response . status error . reason = http_response . reason error . body = body error . headers = atom . http_core . get_headers ( http_response ) return error
creates a new exception and sets the http information in the error .