From e5d9e0da0cc21d26fb8c65ddbd229377aef7e75c Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Thu, 21 May 2026 17:47:51 +0800 Subject: [PATCH] =?UTF-8?q?debug(update-service):=20=E5=9C=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=93=8D=E5=BA=94=E4=B8=AD=E6=9A=B4=E9=9C=B2=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BF=A1=E6=81=AF=EF=BC=88=E4=B8=B4=E6=97=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用于排查上传接口 500 错误的根本原因,确认后将恢复。 Co-Authored-By: Claude Sonnet 4.6 --- .../com/xuqm/update/controller/GlobalExceptionHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/update-service/src/main/java/com/xuqm/update/controller/GlobalExceptionHandler.java b/update-service/src/main/java/com/xuqm/update/controller/GlobalExceptionHandler.java index 6238145..6eccf7a 100644 --- a/update-service/src/main/java/com/xuqm/update/controller/GlobalExceptionHandler.java +++ b/update-service/src/main/java/com/xuqm/update/controller/GlobalExceptionHandler.java @@ -46,8 +46,13 @@ public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) public ResponseEntity> handle(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() - .body(ApiResponse.error(500, "服务器内部错误")); + .body(ApiResponse.error(500, detail)); } private HttpStatus resolveStatus(int code) {