InvalidOperationException Class

This exception should be raised by the driver to reject a command from the client.

Definition

Namespace: ASCOM
Assembly: ASCOM.Exceptions (in ASCOM.Exceptions.dll) Version: 6.0.0.0 (7.0.9999.9999)
C#
[SerializableAttribute]
[ComVisibleAttribute(true)]
[GuidAttribute("64DC4F51-E5EB-4F28-A8B9-782F78A778FA")]
public class InvalidOperationException : DriverException
Inheritance
Object    Exception    DriverException    InvalidOperationException

Remarks

The exception is intended to be used for "logical" errors e.g. trying to use a command when the current configuration of the device does not allow it rather than for device errors such as a communications error.

Its the error to use when the client attempts something, which at another time would be sensible, but which is not sensible right now. If you expect the condition causing the issue to be short lived, you may choose to stall the request until the condition is cleared rather than throwing this exception. Clearly, that is a judgement that you can only make given a specific scenario.

If you need to throw this error as a COM exception use the error number: 0x8004040B.

Constructors

InvalidOperationException Default public constructor for NotConnectedException takes no parameters.
InvalidOperationException(Exception) Initializes a new instance of the InvalidOperationException class from another exception.
InvalidOperationException(String) Initializes a new instance of the InvalidOperationException class with a non-default error message.
InvalidOperationException(String, Exception) Initializes a new instance of the InvalidOperationException class based on another exception.

Properties

Number The COM error code for this exception (hex 80040400 - 800404FF)
(Inherited from DriverException)

Extension Methods

ErrorCode Extension method to get the Alpaca Error Code for an Exception. Returns UnspecifiedError if it cannot find a better code
(Defined by ExceptionHelpers)

Version Information

.NET Standard

Supported in: 2.0

See Also