/// <summary>
        /// Returns true if matched.  If no match, out param "message"
        /// will be null.  If match, out param "message" will be either
        /// the message that should be shown, or null if no message
        /// should be shown to the user.
        /// </summary>
        internal bool GetMessage(out ExceptionMessage message, Exception e)
        {
            Type t = e.GetType();
            for (int i = 0; i < handlers.Count; i++)
            {
                IDynamicExceptionMessage msg = (IDynamicExceptionMessage)handlers[i];
                if (msg.AppliesTo(t, e))
                {
                    message = msg.GetMessage(e);
                    return true;
                }
            }

            message = null;
            return false;
        }
 public ErrorCodeDynamicExceptionMessage(Type exceptionType, int errorCode, ExceptionMessage exceptionMessage) : base(true)
 {
     this.exceptionType    = exceptionType;
     this.errorCode        = errorCode;
     this.exceptionMessage = exceptionMessage;
 }
 public SimpleDynamicExceptionMessage(Type exceptionType, ExceptionMessage exceptionMessage, bool recurseInnerExceptions) : base(recurseInnerExceptions)
 {
     this.exceptionType    = exceptionType;
     this.exceptionMessage = exceptionMessage;
 }
 public Win32ErrorCodeDynamicExceptionMessage(int errorCode, ExceptionMessage exceptionMessage) : base(typeof(Win32Exception), errorCode, exceptionMessage)
 {
 }
 public COMErrorCodeDynamicExceptionMessage(int errorCode, ExceptionMessage exceptionMessage) : base(typeof(COMException), errorCode, exceptionMessage)
 {
 }
 public ErrorCodeDynamicExceptionMessage(Type exceptionType, int errorCode, ExceptionMessage exceptionMessage) : base(true)
 {
     this.exceptionType = exceptionType;
     this.errorCode = errorCode;
     this.exceptionMessage = exceptionMessage;
 }
 public SimpleDynamicExceptionMessage(Type exceptionType, ExceptionMessage exceptionMessage, bool recurseInnerExceptions) : base(recurseInnerExceptions)
 {
     this.exceptionType = exceptionType;
     this.exceptionMessage = exceptionMessage;
 }
 public Win32ErrorCodeDynamicExceptionMessage(int errorCode, ExceptionMessage exceptionMessage) : base(typeof(Win32Exception), errorCode, exceptionMessage)
 {
 }
 public COMErrorCodeDynamicExceptionMessage(int errorCode, ExceptionMessage exceptionMessage) : base(typeof(COMException), errorCode, exceptionMessage)
 {
 }