TIBCO Enterprise Message Service 4.3.0 .NET Client Class Library

Connection.ExceptionHandler Event

The exception event handler

public event EMSExceptionHandler ExceptionHandler;

Event Data

The event handler receives an argument of type EMSExceptionEventArgs containing data related to this event. The following EMSExceptionEventArgs property provides information specific to this event.

Property Description
Exception Get the EMSException which caused the event

Remarks

Delegate declaration for exception handler is as follows:

public delegate void EMSExceptionHandler(object sender, EMSExceptionEventArgs args); 
sender: The source of the event, the connection in this case.
args: The event argument, EMSExceptionEventArgs
Example of using the exception event handler:
...
connection.ExceptionHandler += new EMSExceptionHandler(handleEx);
...
private void handleEx(object sender, EMSExceptionEventArgs arg)
{
   EMSException e = arg.Exception;
   Console.WriteLine("Exception: " + e.Message);
}
...
User should either use ExceptionHandler or ExceptionListener to handle exceptions, but not both. Setting up both will cause the exception to be handled more than once which can result in undefined behavior
For complete details, see the corresponding item in the book TIBCO Enterprise Message Service .NET Reference.

Exceptions

Exception Type Condition
IllegalStateException If the connection is closed

See Also

Connection Class | TIBCO.EMS Namespace