Exemplo n.º 1
0
        public static ExceptionNode Create(Exception exception)
        {
            if (exception == null)
            {
                return(null);
            }

            return(new ExceptionNode {
                Type = TypeSpec.Parse(exception.GetType()),
                Message = exception.Message,
                InnerException = ExceptionNode.Create(exception.InnerException),
                StackTrace = StackTrace.Create(new System.Diagnostics.StackTrace(exception, true))
            });
        }
Exemplo n.º 2
0
        public virtual void VisitExceptionNode(ExceptionNode exception)
        {
            VisitTypeSpec(exception.Type);

            if (exception.Message != null)
            {
                writer.Write(": {0}", exception.Message);
            }

            if (exception.InnerException != null)
            {
                writer.Write(" ---> ");
                exception.InnerException.AcceptVisitor(this);
                writer.WriteLine();
                writer.Write("  --- End of inner exception stack trace ---");
            }

            if (exception.StackTrace != null)
            {
                writer.WriteLine();
                exception.StackTrace.AcceptVisitor(this);
            }
        }