Exception Classes
The ASCOM interfaces share a set of standard exception classes, including one,
DriverException, which may be used flexibly by a driver to indicate
various problems, each with a custom driver error code and message.
Note
The exception codes shown here are generic values used by Alpaca or any other environment. For classic ASCOM COM, in the Windows environment, these (16-bit) codes are logically ‘or’ed with 0x80040000 (Windows generic user exception). So, for example, the value 0x40B would appear in the COM context as 0x8004040B.
Bases: ASCOM.DeviceInterface
- exception ActionNotImplementedException(message: str)
Exception thrown by a driver when it receives an unknown command through the Action method.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x040C (1036)
- exception DriverException(number: int, message: str)
Generic driver exception. See note below.
- Parameters:
number (int) – The error number 0x500-0xFFF. See the info at the top of this page for specifics in the Windows COM environment. The driver may choose this number for its own purposes.
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Note
This is the generic driver exception. Drivers are permitted to directly throw these exceptions. This exception should only be thrown if there is no other more appropriate exception as listed here are already defined. These specific exceptions should be thrown where appropriate rather than using the more generic DriverException. Conform will not accept DriverExceptions where more appropriate exceptionsare already defined.
- exception InvalidOperationException(message: str)
This exception should be thrown by the driver to reject a command from the client.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x40B (1035)
- exception InvalidValueException(message: str)
Exception to report an invalid value supplied to a driver.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction such as the legal range for the value.
Numeric value: 0x401 (1025)
- exception MethodNotImplementedException(message: str)
All methods defined by the relevant ASCOM standard interface must exist in each driver. However, those methods do not all have to be implemented. The minimum requirement for each defined method is to throw
MethodNotImplementedException.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction. At a minimum it must contain the method name.
Numeric value: 0x400 (1024)
Note
For historical reasons, this exception shares the same numeric code as
PropertyNotImplementedException.
- exception NotConnectedException(message: str)
This exception should be thrown when an operation is attempted that requires communication with the device, but the device is disconnected.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x407 (1031)
This refers to the driver not being connected to the device. It is not for network outages or bad URLs.
- exception OperationCancelledException(message: str)
This exception should be thrown to indicate that an (asynchronous) in-progress operation has been cancelled.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x40E (1038)
- exception ParkedException(message: str)
This exception should be thrown to indicate that movement (or other invalid operation) was attempted while the device was in a parked state.
Numeric value: 0x408 (1032)
- exception PropertyNotImplementedException(message: str)
All properties defined by the relevant ASCOM standard interface must exist in each driver. However, those properties do not all have to be implemented. The minimum requirement for each defined property is to throw
PropertyNotImplementedException.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction. At a minimum it must contain the property name.
Numeric value: 0x400 (1024)
Note
For historical reasons, this exception shares the same numeric code as
MethodNotImplementedException.
- exception SlavedException(message: str)
This exception should be used to indicate that movement (or other invalid operation) was attempted while the device was in slaved mode. This applies primarily to Dome drivers.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x409 (1033)
- exception ValueNotSetException(message: str)
Exception to report that no value has yet been set for this property.
- Parameters:
message (str) – The textual error message, which should always be informative and useful to help identify and solve the problem. It may even contain suggestions for correction.
Numeric value: 0x402 (1026)