Falcon.SugarApi/Falcon.SugarApi/ExceptionExtend.cs
2024-06-03 16:38:48 +08:00

26 lines
706 B
C#

using System;
namespace Falcon.SugarApi
{
/// <summary>
/// 异常扩展
/// </summary>
public static class ExceptionExtend
{
/// <summary>
/// 链接异常信息,返回异常信息长串。
/// </summary>
/// <param name="exception">异常信息</param>
/// <returns>异常信息长串</returns>
public static string InnerExceptionLink(this Exception exception) {
var inne = exception.InnerException;
if(inne == null) {
return exception.Message;
}
else {
return $"{exception.Message} ---> {inne.InnerExceptionLink()}";
}
}
}
}