From 0c4561edebb62304047809ff30ef0b4cf7255052 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Mon, 13 Nov 2023 20:45:53 +0800 Subject: [PATCH] =?UTF-8?q?JD=E6=98=BE=E7=A4=BA=E6=BA=90=E6=98=AF=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JD.API/Middlewares/CustomExceptionMiddleWare.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JD.API/Middlewares/CustomExceptionMiddleWare.cs b/JD.API/Middlewares/CustomExceptionMiddleWare.cs index da17e1db..99681780 100644 --- a/JD.API/Middlewares/CustomExceptionMiddleWare.cs +++ b/JD.API/Middlewares/CustomExceptionMiddleWare.cs @@ -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