RAD Studio VCL Reference
TComObject.ServerExceptionHandler Property

Provides access to the SafeCall exception notification process.

property ServerExceptionHandler: IServerExceptionHandler;
__property IServerExceptionHandler ServerExceptionHandler;

The ServerExceptionHandler property provides a way for you to access the SafeCall exception notification process so that you can log or reroute those notifications to an external monitor. The monitor can be another object within the same COM server module, or it could be on a different machine entirely. 

For example, server exception handlers could be implemented to: 

Log COM server exceptions to the NT system event log 

Write exceptions to a text file 

Send email to an administrator 

Alert support personnel through a pager 

The ServerExceptionHandler property is useful for administering remote servers, particularly if a server is physically unreachable. For example, when an exception is raised in a COM object, if the server application is a VCL forms-based application (not just a DLL), then the VCL default exception handler may show a message box on the server. No client requests on that COM object instance can be serviced until the message box is closed. By reporting the exception to an event log, others can see the information from any remote location, as long as the remote users have access rights on the server.

Tip: The ServerExceptionHandler property would be particularly useful for COM objects (either stand-alone or those running in the MTS environment), that are used in active server pages. You can use the ServerExceptionHandler property to write exception information in HTML or in any other format you desire.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!