debug(update-service): 在错误响应中暴露异常信息(临时)
用于排查上传接口 500 错误的根本原因,确认后将恢复。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
d49d0297cf
当前提交
e5d9e0da0c
@ -46,8 +46,13 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseEntity<ApiResponse<Void>> handle(Exception ex) {
|
public ResponseEntity<ApiResponse<Void>> handle(Exception ex) {
|
||||||
log.error("Unhandled exception", ex);
|
log.error("Unhandled exception", ex);
|
||||||
|
String detail = ex.getClass().getSimpleName() + ": " + ex.getMessage();
|
||||||
|
Throwable cause = ex.getCause();
|
||||||
|
if (cause != null) {
|
||||||
|
detail += " | caused by: " + cause.getClass().getSimpleName() + ": " + cause.getMessage();
|
||||||
|
}
|
||||||
return ResponseEntity.internalServerError()
|
return ResponseEntity.internalServerError()
|
||||||
.body(ApiResponse.error(500, "服务器内部错误"));
|
.body(ApiResponse.error(500, detail));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpStatus resolveStatus(int code) {
|
private HttpStatus resolveStatus(int code) {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户