新增异常扩展
This commit is contained in:
parent
e68ee4ec04
commit
ecb879b571
25
Falcon.SugarApi/ExceptionExtend.cs
Normal file
25
Falcon.SugarApi/ExceptionExtend.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
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()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user