您现在的位置是: 首页 >  .NET CORE >  文章详情 文章详情

.net core API 统一拦截错误

2019-08-19 【.NET CORE】 1730人浏览

public override void OnActionExecuted(ActionExecutedContext context) {
    if (context.Exception != null) {
        context.Result = new JsonResult(new APIReturn(-1, context.Exception.Message));
    }
}



很赞哦! (0)

站长推荐