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