26 lines
706 B
C#
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()}";
|
|
}
|
|
}
|
|
}
|
|
}
|