Error Handling Considerations for the StylusInput APIs
Error Handling Considerations for the StylusInput APIs |
Overview of error handling when using the StylusInput application programming interfaces (APIs).
Unhandled exceptions thrown by a plug-in are caught by the RealTimeStylus object. When a plug-in throws an exception, the normal flow of data is interrupted. The RealTimeStylus object:
- Creates an ErrorData object.
- Calls the IStylusSyncPlugin.Error or IStylusAsyncPlugin.Error method of the plug-in that threw the exception.
- Calls the IStylusSyncPlugin.Error or IStylusAsyncPlugin.Error method of the remaining plug-ins in that collection.
- If the plug-in that threw the exception is a synchronous plug-in, the ErrorData object is added to the output queue.
- The RealTimeStylus object resumes normal processing of the original data.
If a plug-in throws an exception from its Error method, the RealTimeStylus object catches the exception but does not generate a new ErrorData object. For more information about how ErrorData is added to the queue, see Plug-in Data and the RealTimeStylus Class.
The RealTimeStylus object does not stop processing data from the tablet pen's data stream when one of its plug-ins throws an exception. Depending on your design, some of your plug-ins may need to subscribe to the ErrorData notification and modify their behavior when an exception occurs.