|
|
@ -34,7 +34,7 @@ namespace JD.API.Middlewares |
|
|
|
{ 401, "未授权的请求" }, |
|
|
|
{ 404, "找不到该资源" }, |
|
|
|
{ 403, "访问被拒绝" }, |
|
|
|
{ 500, "服务器发生意外的错误" }, |
|
|
|
//{ 500, "服务器发生意外的错误" },
|
|
|
|
{ 503, "服务不可用" } |
|
|
|
//其余状态自行扩展
|
|
|
|
}; |
|
|
@ -59,6 +59,7 @@ namespace JD.API.Middlewares |
|
|
|
context.Response.Clear(); |
|
|
|
context.Response.StatusCode = 500; //发生未捕获的异常,手动设置状态码
|
|
|
|
nLogManager.Default().Error(ex); //记录错误
|
|
|
|
await ErrorHandle(context, context.Response.StatusCode, ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
finally |
|
|
|