添加基础api控制器异常响应结果
This commit is contained in:
parent
0a85919d2d
commit
ed42d18013
|
@ -247,6 +247,21 @@ namespace Falcon.SugarApi.ApiDefinistions
|
||||||
protected virtual async Task<ApiResult<T>> FailResultAsync<T>(string failMessage)
|
protected virtual async Task<ApiResult<T>> FailResultAsync<T>(string failMessage)
|
||||||
=> await Task.FromResult(FailResult<T>(failMessage));
|
=> await Task.FromResult(FailResult<T>(failMessage));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异步返回api错误信息和异常信息
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">返回数据类型</typeparam>
|
||||||
|
/// <param name="failMessage">错误信息</param>
|
||||||
|
/// <param name="ex">产生的异常</param>
|
||||||
|
/// <returns>api异常结果</returns>
|
||||||
|
protected virtual async Task<ApiResult<T>> ExceptionResultAsync<T>(string failMessage,Exception ex) {
|
||||||
|
var result = FailResult<T>(f => {
|
||||||
|
f.Msg = failMessage;
|
||||||
|
f.Exception = ex.ToString();
|
||||||
|
});
|
||||||
|
return await Task.FromResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 数据缓存
|
#region 数据缓存
|
||||||
|
|
Loading…
Reference in New Issue
Block a user