.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  阅读(...)  评论(...编辑  收藏