Sdílet prostřednictvím


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:

  1. Creates an ErrorData object.
  2. Calls the IStylusSyncPlugin.Error or IStylusAsyncPlugin.Error method of the plug-in that threw the exception.
  3. Calls the IStylusSyncPlugin.Error or IStylusAsyncPlugin.Error method of the remaining plug-ins in that collection.
  4. If the plug-in that threw the exception is a synchronous plug-in, the ErrorData object is added to the output queue.
  5. 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.