Adding error-handling code

Errors occurring during a method call should be handled as follows:

  1. Call the IJagServer::WriteLog method to write a description of the error to the log file.

    NoteJagAxWrap.dll must be registered on your machine. If you are developing on a machine that already has EAServer installed on it, JagAxWrap.dll is already registered.

  2. You can also generate an ActiveX automation exception with text that describes the error. EAServer returns the text of the exception to the client. Java clients receive the message as a Java exception (class com.sybase.jaguar.util.JException) and ActiveX clients receive the message as an ActiveX automation exception.

In general, if an error prevents completion of a desired task (such as database updates that represent a new sales order), you should generate an ActiveX automation exception to send a concise description of the problem to the client. Messages sent to the client should be concise and contain language suitable for display to the end user. You can record more detailed messages in the log file.

NoteIDL user-defined exceptions are not supported.

NoteNever write your component to send error messages to the console to display dialog boxes. Servers run unattended; showing a dialog box will do nothing but hang the thread that executes your component.