优化统一错误码返回

This commit is contained in:
白茶清欢 2025-06-16 16:54:37 +08:00
parent 6be7aad22e
commit 42e26ebd67

View File

@ -129,7 +129,8 @@ public class Response<Data> implements Serializable {
public Response<Data> failure(RuntimeContext runtimeContext, HttpStatus httpStatus, CustomException customException) { public Response<Data> failure(RuntimeContext runtimeContext, HttpStatus httpStatus, CustomException customException) {
setHandleSuccess(false); setHandleSuccess(false);
setErrorDetail(customException.getStackTrace()); // 异常堆栈 setErrorDetail(customException.getStackTrace()); // 异常堆栈
return any(runtimeContext, httpStatus, customException.getCode(), customException.getMessage(), null); // 错误码使用 category+_+code
return any(runtimeContext, httpStatus, customException.getCategory() + "_"+customException.getCode(), customException.getMessage(), null);
} }
// 任意姿势的响应 // 任意姿势的响应