StreamLink.NET
ExceptionHandler Property
StreamLink.NETCaplin.StreamLinkIStreamLinkExceptionHandler
Gets or sets the exception handler.
Declaration Syntax
C#Visual BasicVisual C++
IExceptionHandler ExceptionHandler { get; set; }
Property ExceptionHandler As IExceptionHandler
property IExceptionHandler^ ExceptionHandler {
	IExceptionHandler^ get ();
	void set (IExceptionHandler^ value);
}
Value
The exception handler.
Remarks

If you want to be informed of internal unhandled exceptions that occur within the StreamLink library then the ExceptionHandler property must be set. You need to define a class that implements the IExceptionHandler interface and set the ExceptionHandler property to an instance of this class. You are recommended to do this since any exception that occurs will indicate that the internal state of the StreamLink library can no longer be relied upon as being correct.

When an internal exception occurs the application should be restarted; this is the only way to recover from such an exception.

Examples
CopyC#
using System;
using System.Collections.Generic;
using System.Text;

using Caplin.StreamLink;
using Caplin.StreamLink.Authentication;

namespace StreamLinkExamples.Basics
{
    /// <summary>
    /// Example inner class that implements IExceptionHandler and
    /// a an outline of how it may be used.
    /// </summary>
    public class SettingUpAnExceptionHandler
    {
        /// <summary>
        /// An example of how to set up a very basic exception handler.
        /// </summary>
        public static void SettingUpAnExceptionHandlerExample()
        {
            // Create a basic StreamLink instance
            IStreamLink myStreamLink = new StreamLink();

            // Set up the exception handler
            myStreamLink.ExceptionHandler = new ExampleExceptionHandler();
        }

        /// <summary>
        /// Example class that implements IExceptionHandler
        /// </summary>
        private class ExampleExceptionHandler: IExceptionHandler
        {
            /// <summary>
            /// IExceptionHandler method called when an unexpected exception
            /// occurs within the StreamLink library.
            /// </summary>
            /// <param name="ex">The exception.</param>
            public void HandleException(Exception ex)
            {
                // Clean up application

                // Warn the user about the error and that the application is
                // to close

                // Close the application
            }
        }
    }
}
See Also

Assembly: Caplin.StreamLink (Module: Caplin.StreamLink) Version: 5.0.19.0 (5.0.19.0)