Exceptions - Classes Defining Alpaca Exceptions
This module contains the ASCOM Exception classes. They are used to represent the Alpaca-standard error codes and default error messages as input to construction of all JSON responses. The error messages may be overridden (and probably should be so as to give the most help to the app user).
DriverException is special. It takes an additional
parameter, a Python Exception object, and will produce a Alpaca ErrorMessge
containing the Python runtime error info.
Note
When creating an instance, the exception is automatically logged, including any overridden error message.
Exception Classes
- class exceptions.ActionNotImplementedException(message: str = 'The requested action is not implemented in this driver.')
Requested
Action()is not implementedInitialize the
ActionNotImplementedExceptionobject- Parameters:
number (
int) – 0x040C (1036)message (
str) – ‘The requested action is not implemented in this driver.’
Logs
ActionNotImplementedException: {message}
- class exceptions.DriverException(number: int = 1280, message: str = 'Internal driver error - this should be more specific.', exc=None)
- Exception Class for Driver Internal Errors
This exception is used for device errors and other internal exceptions. It can be instantiated with a captured exception object, and if so format the Alpaca error message to include line number/module or optionally a complete traceback of the exception (a config option).
Initialize the DeviceException object
- Parameters:
number (
int) – Alpaca error number between 0x500 and 0xFFF, your choice defaults to 0x500 (1280)message (
str) – Specific error message or generic if left blank. Defaults to ‘Internal driver error - this should be more specific.’exc – Contents ‘ex’ of ‘except Exception as ex:’ If not included then only message is included. If supplied, then a detailed error message with traceback is created (see full parameter)
Notes
Checks error number within legal range and if not, logs this error and substitutes 0x500 number.
If the Python exception object is included as the 3rd argument, it constructs a message containing the name of the underlying Python exception and its basic context. If
verbose_driver_exceptionsistrue, a complete Python traceback is included.Logs the constructed
DriverExceptionmessage
- class exceptions.InvalidOperationException(message: str = 'The requested operation cannot be undertaken at this time.')
The client asked for something that can’t be done
Initialize the
InvalidOperationExceptionobject- Parameters:
number (
int) – 0x040B (1035)message (
str) – ‘The requested operation cannot be undertaken at this time.’
Logs
InvalidOperationException: {message}
- class exceptions.InvalidValueException(message: str = 'Invalid value given.')
A value given is invalid or out of range
Initialize the
InvalidValueExceptionobject- Parameters:
number (
int) – 0x401 (1025)message (
str) – ‘Invalid value given.’
Logs
InvalidValueException: {message}
- class exceptions.NotConnectedException(message: str = 'The device is not connected.')
The device must be connected and is not at this time
Initialize the
NotConnectedExceptionobject- Parameters:
number (
int) – 0x407 (1031)message (
str) – ‘The device is not connected.’
Logs
NotConnectedException: {message}
- class exceptions.NotImplementedException(message: str = 'Property or method not implemented.')
The requested property or method is not implemented
Initialize the
NotImplementedExceptionobject- Parameters:
number (
int) – 0x400 (1024)message (
str) – ‘Property or method not implemented.’
Logs
NotImplementedException: {message}
- class exceptions.OperationCancelledException(message: str = 'In-progress (async) operation was cancelled.')
An (asynchronous) in-progress operation has been cancelled
Initialize the
OperationCancelledExceptionobject- Parameters:
number (
int) – 0x400 (1024)message (
str) – ‘In-progress (async) operation was cancelled.’
Logs
OperationCancelledException: {message}
- class exceptions.ParkedException(message: str = 'Illegal operation while parked.')
Cannot do this while the device is parked
Initialize the
ParkedExceptionobject- Parameters:
number (
int) – 0x408 (1032)message (
str) – ‘Illegal operation while parked.’
Logs
ParkedException: {message}
- class exceptions.SlavedException(message: str = 'Illegal operation while slaved.')
Cannot do this while the device is slaved
Initialize the
SlavedExceptionobject- Parameters:
number (
int) – 0x409 (1033)message (
str) – ‘Illegal operation while slaved.’
Logs
SlavedException: {message}
- class exceptions.Success
Default err input to response classes, indicates success
Initialize the Success object
- Parameters:
number (
int) – 0message (
str) –’’
- class exceptions.ValueNotSetException(message: str = 'The value has not yet been set.')
The requested vzalue has not yet een set
Initialize the
ValueNotSetExceptionobject- Parameters:
number (
int) – 0x402 (1026)message (
str) – ‘The value has not yet been set.’
Logs
ValueNotSetException: {message}