def _get_error_message_for_connection_error(self, connection_error): # type: (RequestsConnectionError) -> str # To get the underlying error that raised the # requests.ConnectionError it is required to go down two levels of # arguments to get the underlying exception. The instantiation of # one of these exceptions looks like this: # # requests.ConnectionError( # urllib3.exceptions.ProtocolError( # 'Connection aborted.', <SomeException>) # ) message = connection_error.args[0].args[0] underlying_error = connection_error.args[0].args[1] if is_broken_pipe_error(underlying_error): message += ( ' Lambda closed the connection before chalice finished ' 'sending all of the data.') elif isinstance(underlying_error, socket.timeout): message += ' Timed out sending your app to Lambda.' return message
def _get_error_message_for_connection_error(self, connection_error): # type: (RequestsConnectionError) -> str # To get the underlying error that raised the # requests.ConnectionError it is required to go down two levels of # arguments to get the underlying exception. The instantiation of # one of these exceptions looks like this: # # requests.ConnectionError( # urllib3.exceptions.ProtocolError( # 'Connection aborted.', <SomeException>) # ) message = connection_error.args[0].args[0] underlying_error = connection_error.args[0].args[1] if is_broken_pipe_error(underlying_error): message += ( ' Lambda closed the connection before chalice finished ' 'sending all of the data.' ) elif isinstance(underlying_error, socket.timeout): message += ' Timed out sending your app to Lambda.' return message