12.7 Exceptions and Errors |
All public methods exposed by the ClientLib APIs can throw Exceptions.
Each of these indicate that some unexpected condition has occured either in the ClientLib itself, or on the a currently connected SP-ICE-3 Card.
Note |
---|
Please refer to 12.1 ClientLib and NativeLib API Implementations for details of the Error reporting mechanism implemented by the NativeLib. |
When the ClientLib itself is the source of the exception (of any type), the exception will be thrown without change to the calling application in the usual manner.
An exception thrown by the card's firmware will be passed back to the ClientLib in serialized form via the RPC protocol.
Once the ClientLib has de-serialized the exception, it will be thrown without change to the calling application in the usual manner.
The application can then catch it, examine its information fields, and decide upon an appropriate course of action.
The SP-ICE-3 Card's firmware may throw Standard or SP-ICE-3-Specific exceptions.
The exception will normally carry at least a simple message describing the nature of the problem.
If possible, it will also give you the exact context in which everything went pear-shaped:
the name of the failing command,
the passed values of any parameters,
the command's position within the currently executing List (if applicable),
and a reasonably complete Stack Trace.
Problems are generally reported as soon as they are detected during a call of a combined ClientLib/SP-ICE-3 Card method.
Sometimes, however, the problem is not, or even cannot be, detected until run-time
, when a CommandList is being executed.
This is the case, for instance, with:
bad values of CommandCode Parameters;
calculated values of scanner co-ordinates which fall outside the available scanning field;
etc.
Exceptions thrown by functions in the ClientLib API may be divided into three broad categories:
The C# Language and Runtime Framework define many standard exceptions.
These include: ArgumentOutOfRangeException; NullReferenceException; etc, etc.
Since all of the standard exceptions are adequately documented elsewhere, we will not concern ourselves further with them here.
The MsgPack-RPC library usually makes its presence felt only when something completely bogus occurs within the RPC protocol between the ClientLib and the SP-ICE-3 Card.
For instance: trying to call a function which does not exist on the card - although this should be practically impossible, assuming you're using the ClientLib to talk to the card, and given the compatibility checking which takes place automatically when the ClientLib first makes contact with the card.
The RAYLASE.SPICE3 namespace defines several specialised exception types, which allow precise reporting of problems within the context and execution model of the combined ClientLib and SP-ICE-3 Card system.
Here is a list of all the currently defined specialised exceptions, together with some general hints on how to avoid them:
Exception | Typically Thrown By | Possible Remedies |
---|---|---|
Do not press the abort button again... | ||
Use the information contained in the error message to modify properties of ProcessVariables or contents of CommandLists as necessary. | ||
Please refer to SP-ICE-3 Fatal Exceptions. Use the information contained in the error message to modify properties of ProcessVariables or contents of CommandLists as necessary. | ||
Check how your application constructs its CommandLists. | ||
Use the information contained in the error message to modify properties of ProcessVariables or contents of CommandLists as necessary. | ||
Verify the ListID's used by your application. | ||
Any API method that attempts to | Verify the method your application uses to connect to the card(s). Verify that the card is operating normally, and (if applicable) is currently reachable via the network. | |
Verify ScannerConfigFieldSize and MotfConfig parameters, | ||
Use the information contained in the error message to modify properties of ProcessVariables or contents of CommandLists as necessary. | ||
ScannerCommunicationAPIReceiveEnhanced, | Verify the physical power and data connections to the scanner( s). Or Check that the correct ScanHeadFormat has been selected by your application. | |
Use a ClientLib whose API-version matches that of the card's firmware. Or Update the Adapter Board's firmware to match the card's, or vice versa. |
FatalExceptions are thrown by the SP-ICE-3 Card when it detects certain unrecoverable error conditions during command execution.
The FatalException carries an Error property that indicates the underlying error condition.
Here are possible causes and remedies for some currently defined FatalExceptionErrors:
|