Handle Exceptions |
Scroll |
When an error occurs during the execution of a method (e.g. invalid input parameters, array index out of range, bad network connection, etc.) an exception is thrown. The Thereforeā¢ API uses the IErrorInfo interface to report exceptions to the client. Wrap potentially throwing methods in a try-catch block and provide appropriate error handling for the various exceptions. The API Reference provides information which methods throw exceptions and under what conditions these exceptions may occur.
The Thereforeā¢ API Reference contains exception listings for most methods and some properties.
These listings include: Exceptions thrown directly by the Thereforeā¢ API. Exceptions thrown because of invalid method parameters. Exceptions thrown because of invalid property values.
They do NOT include: Out of Memory exceptions caused by dynamic allocation. Physical and logical connection problems to the server. SQL and data base exceptions. Access violations. Several other internal errors.
It is therefore important to note that the exception listings in the reference are incomplete and the absence of an exception listing does NOT imply a no-throw-guarantee. |
Visual Basic Imports Therefore.API '...
Dim server As New TheServer Try server.Connect(TheClientType.CustomApplication) Catch e As Exception System.Windows.Forms.MessageBox.Show(e.Message) End Try C# using Therefore.API; //...
TheServer server = new TheServer(); try { server.Connect(TheClientType.CustomApplication); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); } |