removed blank catch
This commit is contained in:
parent
ffddfa21ec
commit
f41b89059a
@ -9,26 +9,19 @@ public static class StringBuilderExtentions
|
|||||||
{
|
{
|
||||||
public static StringBuilder AppendDemystified(this StringBuilder builder, Exception exception)
|
public static StringBuilder AppendDemystified(this StringBuilder builder, Exception exception)
|
||||||
{
|
{
|
||||||
try
|
var stackTrace = new EnhancedStackTrace(exception);
|
||||||
{
|
|
||||||
var stackTrace = new EnhancedStackTrace(exception);
|
|
||||||
|
|
||||||
builder.Append(exception.GetType());
|
builder.Append(exception.GetType());
|
||||||
if (!string.IsNullOrEmpty(exception.Message)) builder.Append(": ").Append(exception.Message);
|
if (!string.IsNullOrEmpty(exception.Message)) builder.Append(": ").Append(exception.Message);
|
||||||
builder.Append(Environment.NewLine);
|
builder.Append(Environment.NewLine);
|
||||||
|
|
||||||
if (stackTrace.FrameCount > 0) stackTrace.AppendTo(builder);
|
stackTrace.AppendTo(builder);
|
||||||
|
|
||||||
if (exception is AggregateException aggEx)
|
if (exception is AggregateException aggEx)
|
||||||
foreach (var ex in EnumerableIList.Create(aggEx.InnerExceptions))
|
foreach (var ex in EnumerableIList.Create(aggEx.InnerExceptions))
|
||||||
builder.AppendInnerException(ex);
|
builder.AppendInnerException(ex);
|
||||||
|
|
||||||
if (exception.InnerException is not null) builder.AppendInnerException(exception.InnerException);
|
if (exception.InnerException is not null) builder.AppendInnerException(exception.InnerException);
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Processing exceptions shouldn't throw exceptions; if it fails
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user