Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions loggr-dotnet/Utility/ExceptionFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,42 +90,15 @@ public static string Format(Exception ex, object traceObject)
res += "<br />";
res += "<b>Traced Object(s)</b><br />";
res += "<br />";
if (traceObject != null)
{
res += ObjectDumper.DumpObject(traceObject, 1);
}
else
{
res += "Not specified<br />";
}
res += ObjectDumper.DumpObject(traceObject, 1);
}

res += "<br />";
res += "<b>Stack Trace</b><br />";
res += "<br />";

FormatStack(ex, ref res);
res += string.IsNullOrEmpty(ex.ToString()) ? "No stack trace" : string.Format("<pre>{0}</pre>", ex.ToString());

return res;
}

protected static void FormatStack(Exception Ex, ref string Buffer)
{
if (Ex.InnerException != null)
{
FormatStack(Ex.InnerException, ref Buffer);
}
Buffer += string.Format("[{0}: {1}]<br />", Ex.GetType().ToString(), Ex.Message);
if (Ex.StackTrace != null)
{
Buffer += HttpUtility.HtmlEncode(Ex.StackTrace).Replace(Environment.NewLine, "<br />");
}
else
{
Buffer += "No stack trace";
}
Buffer += "<br/>";
Buffer += "<br/>";
}
}
}