.net core API 统一拦截错误

public override void OnActionExecuted(ActionExecutedContext context) {
    if (context.Exception != null) {
        context.Result = new JsonResult(new APIReturn(-1, context.Exception.Message));
    }
}
posted @ 2016-09-05 16:26  nicye  阅读(527)  评论(0编辑  收藏  举报