This commit is contained in:
32
server/util/ExceptionUtil.cs
Normal file
32
server/util/ExceptionUtil.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Sockeye.Util
|
||||
{
|
||||
|
||||
|
||||
internal static class ExceptionUtil
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return exception message
|
||||
/// Handles innermost exceptions level by level
|
||||
/// </summary>
|
||||
/// <param name="ex"></param>
|
||||
/// <returns></returns>
|
||||
public static string ExtractAllExceptionMessages(Exception ex)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (ex != null)
|
||||
{
|
||||
sb.AppendLine($"{ex.Source} -> {ex.Message}");
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
Reference in New Issue
Block a user