Click or drag to resize

InvalidOperationException Class

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

Namespace:  ASCOM
Assembly:  ASCOM.Exceptions (in ASCOM.Exceptions.dll) Version: (
public class InvalidOperationException : DriverException

The InvalidOperationException type exposes the following members.

Public methodInvalidOperationException
Default public constructor for NotConnectedException takes no parameters.
Public methodInvalidOperationException(Exception)
Initializes a new instance of the InvalidOperationException class from another exception.
Public methodInvalidOperationException(String)
Initializes a new instance of the InvalidOperationException class with a non-default error message.
Public methodInvalidOperationException(String, Exception)
Initializes a new instance of the InvalidOperationException class based on another exception.
Public propertyData (Inherited from Exception.)
Public propertyHelpLink (Inherited from Exception.)
Public propertyInnerException (Inherited from Exception.)
Public propertyMessage (Inherited from Exception.)
Public propertyNumber
The COM error code for this exception (hex 80040400 - 800404FF)
(Inherited from DriverException.)
Public propertySource (Inherited from Exception.)
Public propertyStackTrace (Inherited from Exception.)
Public propertyTargetSite (Inherited from Exception.)
Public methodGetBaseException (Inherited from Exception.)
Public methodGetObjectData (Inherited from Exception.)
Public methodGetType (Inherited from Exception.)
Public methodToString (Inherited from Exception.)

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.

See Also