Collapse All Expand All

.NET Framework Class Library
Connection Class See Also

[TIBCO.EMS.UFOCLIENT .NET client library 5.1 documentation]

The exception event handler

Namespace: TIBCO.EMS.UFO
Assembly: TIBCO.EMS.UFO (in TIBCO.EMS.UFO.dll)

# Syntax

    public event EMSExceptionHandler ExceptionHandler

    Public Event ExceptionHandler As EMSExceptionHandler

    public:
     event EMSExceptionHandler^ ExceptionHandler {
    	void add (EMSExceptionHandler^ value);
    	void remove (EMSExceptionHandler^ value);
    }

# Remarks

The client library raises an event if it detects a problem with the connection. The program implements a handler delegate to processes it asynchronously and registers the delegate here.

Delegate declaration for exception handler is as follows:

| Copy Code
--- | ---
                public delegate void EMSExceptionHandler(object sender, EMSExceptionEventArgs args);

                sender: The source of the event, the connection in this case.

                args: The event argument, EMSExceptionEventArgs

# Examples

Example of using the exception event handler:

| Copy Code
--- | ---
                ...
                connection.ExceptionHandler += new EMSExceptionHandler(handleEx);
                ...
                private void handleEx(object sender, EMSExceptionEventArgs arg)
                {
                   EMSException e = arg.Exception;
                   Console.WriteLine("Exception: " + e.Message);
                }
                ...

Note:: Use either ExceptionHandler or IExceptionListener 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

# Exceptions

Exception | Condition
--- | ---
IllegalStateException | If the connection is closed

# See Also

Connection Class
TIBCO.EMS.UFO Namespace