How to use the awscrt.exceptions.from_code function in awscrt

To help you get started, we’ve selected a few awscrt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awslabs / aws-crt-python / awscrt / mqtt.py View on Github external
def on_suback(packet_id, topic_qos_tuples, error_code):
            if error_code:
                future.set_exception(awscrt.exceptions.from_code(error_code))
            else:
                future.set_result(dict(
                    packet_id=packet_id,
                    topics=[(topic, _try_qos(qos)) for (topic, qos) in topic_qos_tuples],
                ))
github awslabs / aws-crt-python / awscrt / mqtt.py View on Github external
def on_connect(error_code, return_code, session_present):
            if return_code:
                future.set_exception(Exception(ConnectReturnCode(return_code)))
            elif error_code:
                future.set_exception(awscrt.exceptions.from_code(error_code))
            else:
                future.set_result(dict(session_present=session_present))
github awslabs / aws-crt-python / awscrt / auth.py View on Github external
def _on_complete(error_code, access_key_id, secret_access_key, session_token):
            try:
                if error_code:
                    future.set_exception(awscrt.exceptions.from_code(error_code))
                else:
                    credentials = AwsCredentials(access_key_id, secret_access_key, session_token)
                    future.set_result(credentials)

            except Exception as e:
                future.set_exception(e)
github awslabs / aws-crt-python / awscrt / http.py View on Github external
def on_connection_setup(binding, error_code):
                if error_code == 0:
                    connection._binding = binding
                    future.set_result(connection)
                else:
                    future.set_exception(awscrt.exceptions.from_code(error_code))
github awslabs / aws-crt-python / awscrt / http.py View on Github external
def _on_complete(self, error_code):
        if error_code == 0:
            self._completion_future.set_result(self._response_status_code)
        else:
            self._completion_future.set_exception(awscrt.exceptions.from_code(error_code))
github awslabs / aws-crt-python / awscrt / http.py View on Github external
def on_shutdown(error_code):
                if error_code:
                    shutdown_future.set_exception(awscrt.exceptions.from_code(error_code))
                else:
                    shutdown_future.set_result(None)
github awslabs / aws-crt-python / awscrt / mqtt.py View on Github external
def _on_connection_interrupted(self, error_code):
        if self._on_connection_interrupted_cb:
            self._on_connection_interrupted_cb(connection=self, error=awscrt.exceptions.from_code(error_code))
github awslabs / aws-crt-python / awscrt / auth.py View on Github external
def _on_complete(error_code):
        try:
            if error_code:
                future.set_exception(awscrt.exceptions.from_code(error_code))
            else:
                future.set_result(http_request)
        except Exception as e:
            future.set_exception(e)