修复自定义异常NPE问题

This commit is contained in:
白茶清欢 2025-06-16 20:27:08 +08:00
parent c669c268f7
commit 8cc165c9be

View File

@ -128,7 +128,7 @@ 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.getCause().toString()); // 异常堆栈 setErrorDetail(customException.getData()); // 异常堆栈
// 错误码使用 category+_+code // 错误码使用 category+_+code
return any(runtimeContext, httpStatus, customException.getCategory() + "_"+customException.getCode(), customException.getMessage(), null); return any(runtimeContext, httpStatus, customException.getCategory() + "_"+customException.getCode(), customException.getMessage(), null);
} }