Log full exceptions
This commit is contained in:
20
Hcs.WebApp/Utils/ExceptionExtensions.cs
Normal file
20
Hcs.WebApp/Utils/ExceptionExtensions.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Hcs.WebApp.Utils
|
||||
{
|
||||
public static class ExceptionExtensions
|
||||
{
|
||||
public static string CombineMessages(this Exception e)
|
||||
{
|
||||
var stringBuilder = new StringBuilder();
|
||||
var currentException = e;
|
||||
while (currentException != null)
|
||||
{
|
||||
stringBuilder.AppendLine(currentException.Message);
|
||||
|
||||
currentException = currentException.InnerException;
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user