Ejemplo n.º 1
0
        internal static void FormatException(ExceptionInfo exceptionInfo, StringBuilder builder)
        {
            if (exceptionInfo == null)
            {
                return;
            }

            if (builder.Length > 0)
            {
                builder.AppendLine("--------------------------------");
            }

            builder.AppendFormat("{0}: {1}", FormatValue(exceptionInfo.GetType().ToString()), FormatValue(exceptionInfo.Message));
            builder.AppendLine();

            //if (!String.IsNullOrEmpty(exceptionInfo.Source))
            //{
            //    builder.AppendFormat(" Source: {0}", FormatValue(exceptionInfo.Source));
            //    builder.AppendLine();
            //}

            if (!String.IsNullOrEmpty(exceptionInfo.StackTrace))
            {
                builder.AppendFormat(" Stack: {0}", FormatValue(exceptionInfo.StackTrace));
                builder.AppendLine();
            }

            if (exceptionInfo.InnerException != null)
            {
                FormatException(exceptionInfo.InnerException, builder);
            }
        }
Ejemplo n.º 2
0
        public ExceptionInfo(Exception exception)
        {
            if (exception == null)
                throw new ArgumentNullException("exception");

            if (exception.InnerException != null)
                InnerException = new ExceptionInfo(exception.InnerException);
            Message = FixupErrorMessage(exception.Message);
            StackTrace = exception.StackTrace;
            FullMessage = FixupErrorMessage(exception.ToString());
        }
Ejemplo n.º 3
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                try
                {
                    Exception innerEx;
                    try
                    {
                        throw new Exception("Inner ex!");
                    }
                    catch (Exception i)
                    {
                        innerEx = i;
                    }

                    throw new Exception("Test message!", innerEx);
                }
                catch (Exception e)
                {
                    _exception = e;
                    _exceptionInfo = new ExceptionInfo(e);
                }
            }