Ejemplo n.º 1
0
        ///
        /// Handles the thread exception.
        ///
        public static void Application_ThreadException(
            object sender, ThreadExceptionEventArgs e)
        {
            if (!(e.Exception is ExceptionWrapper))
            {
                ExceptionDecorator.Error(e.Exception);
            }
            switch ((e.Exception as ExceptionWrapper).type)
            {
            case ExceptionWrapper.ErrorTypes.Error:
            {
                if ((e.Exception as ExceptionWrapper).withMessage)
                {
                    ExceptionDecorator.Error((e.Exception as ExceptionWrapper).ex, (e.Exception as ExceptionWrapper).message);
                }
                else
                {
                    ExceptionDecorator.Error((e.Exception as ExceptionWrapper).ex);
                }
                break;
            };

            case ExceptionWrapper.ErrorTypes.Fatal:
            {
                if ((e.Exception as ExceptionWrapper).withMessage)
                {
                    ExceptionDecorator.Fatal((e.Exception as ExceptionWrapper).ex, (e.Exception as ExceptionWrapper).message);
                }
                else
                {
                    ExceptionDecorator.Fatal((e.Exception as ExceptionWrapper).ex);
                }
                break;
            };

            case ExceptionWrapper.ErrorTypes.Warning:
            {
                if ((e.Exception as ExceptionWrapper).withMessage)
                {
                    ExceptionDecorator.Warn((e.Exception as ExceptionWrapper).ex, (e.Exception as ExceptionWrapper).message);
                }
                else
                {
                    ExceptionDecorator.Warn((e.Exception as ExceptionWrapper).ex);
                }
                break;
            };

            case ExceptionWrapper.ErrorTypes.Info:
            {
                if ((e.Exception as ExceptionWrapper).withMessage)
                {
                    ExceptionDecorator.Info((e.Exception as ExceptionWrapper).comment, (e.Exception as ExceptionWrapper).message, (e.Exception as ExceptionWrapper).data);
                }
                else
                {
                    ExceptionDecorator.Info((e.Exception as ExceptionWrapper).comment, (e.Exception as ExceptionWrapper).data);
                }
                break;
            };

            case ExceptionWrapper.ErrorTypes.Trace:
            {
                ExceptionDecorator.Trace();
                break;
            };

            case ExceptionWrapper.ErrorTypes.Debug:
            {
                ExceptionDecorator.Trace();
                break;
            };

            default:
            {
                if ((e.Exception as ExceptionWrapper).withMessage)
                {
                    ExceptionDecorator.Error((e.Exception as ExceptionWrapper).ex, (e.Exception as ExceptionWrapper).message);
                }
                else
                {
                    ExceptionDecorator.Error((e.Exception as ExceptionWrapper).ex);
                }
                break;
            };
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Information
 /// </summary>
 /// <param name="comment">description</param>
 /// <param name="data">key/value pair of data</param>
 /// <param name="message">MessageBox text</param>
 public static void Info(this Component Control, string comment, string message = "", ICollection <DictionaryEntry> data = null)
 {
     ExceptionDecorator.Info(comment, message, data);
 }