From fd89050bbb22f5c03d4815debc436192ae0ebc63 Mon Sep 17 00:00:00 2001
From: FalconFly <12919280+falconfly@user.noreply.gitee.com>
Date: Tue, 16 Apr 2024 15:15:24 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0api=E8=BF=94=E5=9B=9E?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Falcon.SugarApi/ApiManager/ApiControllerBase.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/Falcon.SugarApi/ApiManager/ApiControllerBase.cs b/Falcon.SugarApi/ApiManager/ApiControllerBase.cs
index bafa410..9de951c 100644
--- a/Falcon.SugarApi/ApiManager/ApiControllerBase.cs
+++ b/Falcon.SugarApi/ApiManager/ApiControllerBase.cs
@@ -210,8 +210,18 @@ namespace Falcon.SugarApi.ApiManager
/// 异常
/// 异步api结果
protected virtual ApiResult FailResult(Exception exception)
+ => FailResult("运行发生异常",exception);
+
+ ///
+ /// 同步返回失败的结果
+ ///
+ /// data携带的数据类型
+ /// 异常提示
+ /// 异常
+ /// 异步api结果
+ protected virtual ApiResult FailResult(string failMessage,Exception exception)
=> FailResult(b => {
- b.Msg = "运行发生异常";
+ b.Msg = failMessage;
b.Exception = exception.ToString();
});