Files
hcs/Hcs.WebApp/Utils/ExceptionExtensions.cs

21 lines
539 B
C#

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();
}
}
}