mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-25 23:06:59 +00:00
fix: 错误处理返回具体异常信息而非通用"服务器内部错误"
RouterHandlerFactory 的 onFailure 和 catch 两处均丢弃了 e.getMessage(),导致前端无法获知具体报错原因。
This commit is contained in:
1 parent
cf7d64916e
commit
a4e8585e2c
1 file changed
+4
-2
@@ -412,7 +412,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
|
||||
}).onFailure(e -> {
|
||||
LOGGER.error("请求处理失败", e);
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("服务器内部错误"), 500);
|
||||
String msg = e.getMessage() != null ? e.getMessage() : "服务器内部错误";
|
||||
doFireJsonResultResponse(ctx, JsonResult.error(msg), 500);
|
||||
});
|
||||
} else {
|
||||
doFireJsonResultResponse(ctx, JsonResult.data(data));
|
||||
@@ -420,7 +421,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error("请求处理异常", e);
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("服务器内部错误"), 500);
|
||||
String msg = e.getMessage() != null ? e.getMessage() : "服务器内部错误";
|
||||
doFireJsonResultResponse(ctx, JsonResult.error(msg), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user