mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 15:37:28 +00:00
revert: RouterHandlerFactory failureHandler 恢复返回 failure message
原 ctx.failure().getMessage() 是故意设计——RateLimiter 等组件通过 promise.fail() 传递用户友好的错误消息(如"请求次数太多了"),这些消息需要通过 failureHandler 返回给客户端。改为固定"服务器内部错误"会导致这些消息丢失。 仅添加 null 检查防止 NPE。
This commit is contained in:
@@ -181,7 +181,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("未知异常, 请联系管理员"), 503);
|
||||
} else {
|
||||
LOGGER.error("路由处理失败", ctx.failure());
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("服务器内部错误"), 500);
|
||||
String msg = ctx.failure() != null ? ctx.failure().getMessage() : "未知异常";
|
||||
doFireJsonResultResponse(ctx, JsonResult.error(msg), 500);
|
||||
}
|
||||
});
|
||||
} else if (method.isAnnotationPresent(SockRouteMapper.class)) {
|
||||
|
||||
Reference in New Issue
Block a user