コード例 #1
0
        public override string ToString()
        {
            if (OriginalException is not null)
            {
                return(OriginalException.ToString());
            }

            StringBuilder output = new();

            output.Append($"{Type}: {Message}");

            Stack <SerializableException> inners = new();
            SerializableException?        inner  = InnerException;

            while (inner is not null)
            {
                output.Append($" ---> {inner.Type}: {inner.Message}");
                inners.Push(inner);
                inner = inner.InnerException;
            }

            output.AppendLine();

            while (inners.Count > 0)
            {
                inner = inners.Pop();
                output.AppendLine(inner.StackTrace);
                output.AppendLine("   --- End of inner exception stack trace ---");
            }

            output.AppendLine(StackTrace);

            return(output.ToString());
        }
コード例 #2
0
 public override string ToString()
 {
     return(OriginalException?.ToString() ?? base.ToString());
 }