aiocoap.error module¶
Common errors for the aiocoap library
- exception aiocoap.error.Error¶
Bases:
ExceptionBase exception for all exceptions that indicate a failed request
- exception aiocoap.error.HelpfulError¶
Bases:
Error- extra_help(hints={}) str | None¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.RenderableError¶
Bases:
ErrorException that can meaningfully be represented in a CoAP response
- abstractmethod to_message()¶
Create a CoAP message that should be sent when this exception is rendered
- exception aiocoap.error.ResponseWrappingError(coapmessage)¶
Bases:
ErrorAn exception that is raised due to an unsuccessful but received response.
A better relationship with
numbers.codesshould be worked out to doexcept UnsupportedMediaType(similar to the variousOSErrorsubclasses).- to_message()¶
- exception aiocoap.error.ConstructionRenderableError(message=None)¶
Bases:
RenderableErrorRenderableError that is constructed from class attributes
codeandmessage(where the can be overridden in the constructor).- to_message()¶
Create a CoAP message that should be sent when this exception is rendered
- code = 160¶
Code assigned to messages built from it
- message = ''¶
Text sent in the built message’s payload
- exception aiocoap.error.BadRequest(message=None)¶
Bases:
ConstructionRenderableError- code = 128¶
Code assigned to messages built from it
- exception aiocoap.error.Unauthorized(message=None)¶
Bases:
ConstructionRenderableError- code = 129¶
Code assigned to messages built from it
- exception aiocoap.error.BadOption(message=None)¶
Bases:
ConstructionRenderableError- code = 130¶
Code assigned to messages built from it
- exception aiocoap.error.Forbidden(message=None)¶
Bases:
ConstructionRenderableError- code = 131¶
Code assigned to messages built from it
- exception aiocoap.error.NotFound(message=None)¶
Bases:
ConstructionRenderableError- code = 132¶
Code assigned to messages built from it
- exception aiocoap.error.MethodNotAllowed(message=None)¶
Bases:
ConstructionRenderableError- code = 133¶
Code assigned to messages built from it
- exception aiocoap.error.NotAcceptable(message=None)¶
Bases:
ConstructionRenderableError- code = 134¶
Code assigned to messages built from it
- exception aiocoap.error.RequestEntityIncomplete(message=None)¶
Bases:
ConstructionRenderableError- code = 136¶
Code assigned to messages built from it
- exception aiocoap.error.Conflict(message=None)¶
Bases:
ConstructionRenderableError- code = 137¶
Code assigned to messages built from it
- exception aiocoap.error.PreconditionFailed(message=None)¶
Bases:
ConstructionRenderableError- code = 140¶
Code assigned to messages built from it
- exception aiocoap.error.RequestEntityTooLarge(message=None)¶
Bases:
ConstructionRenderableError- code = 141¶
Code assigned to messages built from it
- exception aiocoap.error.UnsupportedContentFormat(message=None)¶
Bases:
ConstructionRenderableError- code = 143¶
Code assigned to messages built from it
- exception aiocoap.error.UnprocessableEntity(message=None)¶
Bases:
ConstructionRenderableError- code = 150¶
Code assigned to messages built from it
- exception aiocoap.error.TooManyRequests(message=None)¶
Bases:
ConstructionRenderableError- code = 157¶
Code assigned to messages built from it
- exception aiocoap.error.InternalServerError(message=None)¶
Bases:
ConstructionRenderableError- code = 160¶
Code assigned to messages built from it
- exception aiocoap.error.NotImplemented(message=None)¶
Bases:
ConstructionRenderableError- code = 161¶
Code assigned to messages built from it
- exception aiocoap.error.BadGateway(message=None)¶
Bases:
ConstructionRenderableError- code = 162¶
Code assigned to messages built from it
Bases:
ConstructionRenderableErrorCode assigned to messages built from it
- exception aiocoap.error.GatewayTimeout(message=None)¶
Bases:
ConstructionRenderableError- code = 164¶
Code assigned to messages built from it
- exception aiocoap.error.ProxyingNotSupported(message=None)¶
Bases:
ConstructionRenderableError- code = 165¶
Code assigned to messages built from it
- exception aiocoap.error.HopLimitReached(message=None)¶
Bases:
ConstructionRenderableError- code = 168¶
Code assigned to messages built from it
- exception aiocoap.error.NoResource¶
Bases:
NotFoundRaised when resource is not found.
- message = 'Error: Resource not found!'¶
Text sent in the built message’s payload
- exception aiocoap.error.UnallowedMethod(message=None)¶
Bases:
MethodNotAllowedRaised by a resource when request method is understood by the server but not allowed for that particular resource.
- message = 'Error: Method not allowed!'¶
Text sent in the built message’s payload
- exception aiocoap.error.UnsupportedMethod(message=None)¶
Bases:
MethodNotAllowedRaised when request method is not understood by the server at all.
- message = 'Error: Method not recognized!'¶
Text sent in the built message’s payload
- exception aiocoap.error.NetworkError¶
Bases:
HelpfulErrorBase class for all “something went wrong with name resolution, sending or receiving packages”.
Errors of these kinds are raised towards client callers when things went wrong network-side, or at context creation. They are often raised from socket.gaierror or similar classes, but these are wrapped in order to make catching them possible independently of the underlying transport.
- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.NoRequestInterface¶
Bases:
RuntimeError,ConstructionRenderableError,NetworkError- code = 165¶
Code assigned to messages built from it
- message = 'Error: No CoAP transport available for this scheme on any request interface.'¶
Text sent in the built message’s payload
- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.ResolutionError¶
Bases:
NetworkErrorResolving the host component of a URI to a usable transport address was not possible
- exception aiocoap.error.MessageError¶
Bases:
NetworkErrorReceived an error from the remote on the CoAP message level (typically a RST)
- exception aiocoap.error.RemoteServerShutdown¶
Bases:
NetworkErrorThe peer a request was sent to in a stateful connection closed the connection around the time the request was sent
- exception aiocoap.error.TimeoutError¶
Bases:
NetworkErrorBase for all timeout-ish errors.
Like NetworkError, receiving this alone does not indicate whether the request may have reached the server or not.
- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.ConRetransmitsExceeded¶
Bases:
TimeoutErrorA transport that retransmits CON messages has failed to obtain a response within its retransmission timeout.
When this is raised in a transport, requests failing with it may or may have been received by the server.
- exception aiocoap.error.RequestTimedOut¶
Bases:
TimeoutErrorRaised when request is timed out.
This error is currently not produced by aiocoap; it is deprecated. Users can now catch error.TimeoutError, or newer more detailed subtypes introduced later.
- exception aiocoap.error.WaitingForClientTimedOut¶
Bases:
TimeoutErrorRaised when server expects some client action:
sending next PUT/POST request with block1 or block2 option
sending next GET request with block2 option
but client does nothing.
This error is currently not produced by aiocoap; it is deprecated. Users can now catch error.TimeoutError, or newer more detailed subtypes introduced later.
- exception aiocoap.error.ConToMulticast¶
Bases:
ValueError,HelpfulErrorRaised when attempting to send a confirmable message to a multicast address.
- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.ResourceChanged¶
Bases:
ErrorThe requested resource was modified during the request and could therefore not be received in a consistent state.
- exception aiocoap.error.UnexpectedBlock1Option¶
Bases:
ErrorRaised when a server responds with block1 options that just don’t match.
- exception aiocoap.error.UnexpectedBlock2¶
Bases:
ErrorRaised when a server responds with another block2 than expected.
- exception aiocoap.error.MissingBlock2Option¶
Bases:
ErrorRaised when response with Block2 option is expected (previous response had Block2 option with More flag set), but response without Block2 option is received.
- exception aiocoap.error.NotObservable¶
Bases:
ErrorThe server did not accept the request to observe the resource.
- exception aiocoap.error.ObservationCancelled¶
Bases:
ErrorThe server claimed that it will no longer sustain the observation.
- exception aiocoap.error.UnparsableMessage¶
Bases:
ErrorAn incoming message does not look like CoAP.
Note that this happens rarely – the requirements are just two bit at the beginning of the message, and a minimum length.
- exception aiocoap.error.LibraryShutdown¶
Bases:
ErrorThe library or a transport registered with it was requested to shut down; this error is raised in all outstanding requests.
- exception aiocoap.error.AnonymousHost¶
Bases:
ErrorThis is raised when it is attempted to express as a reference a (base) URI of a host or a resource that can not be reached by any process other than this.
Typically, this happens when trying to serialize a link to a resource that is hosted on a CoAP-over-TCP or -WebSockets client: Such resources can be accessed for as long as the connection is active, but can not be used any more once it is closed or even by another system.
- exception aiocoap.error.MalformedUrlError¶
Bases:
ValueError,HelpfulError
- exception aiocoap.error.IncompleteUrlError¶
Bases:
ValueError,HelpfulError- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent
- exception aiocoap.error.MissingRemoteError¶
Bases:
HelpfulErrorA request is sent without a .remote attribute
- extra_help(hints={})¶
Information printed at aiocoap-client or similar occasions when the error message itself may be insufficient to point the user in the right direction
The hints dictionary may be populated with context that the caller has; the implementation must tolerate their absence. Currently established keys:
original_uri (str): URI that was attempted to access
request (Message): Request that was assembled to be sent