labthings_fastapi.exceptions

A submodule for custom LabThings-FastAPI Exceptions.

Exceptions

InvocationCancelledError

An invocation was cancelled by the user.

NotConnectedToServerError

The Thing is not connected to a server.

Module Contents

exception labthings_fastapi.exceptions.InvocationCancelledError

Bases: BaseException

An invocation was cancelled by the user.

Note that this inherits from BaseException so won’t be caught by except Exception, it must be handled specifically.

Action code may want to handle cancellation gracefully. This exception should be propagated if the action’s status should be reported as cancelled, or it may be handled so that the action finishes, returns a value, and is marked as completed.

If this exception is handled, the CancelEvent should be reset to allow another InvocationCancelledError to be raised if the invocation receives a second cancellation signal.

Initialize self. See help(type(self)) for accurate signature.

exception labthings_fastapi.exceptions.NotConnectedToServerError

Bases: RuntimeError

The Thing is not connected to a server.

This exception is called if a ThingAction is called or is a ThingProperty is updated on a Thing that is not connected to a ThingServer. A server connection is needed to manage asynchronous behaviour.

Initialize self. See help(type(self)) for accurate signature.