spring boot 3.0.6
This commit is contained in:
@@ -11,29 +11,27 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public Object businessExceptionHandler(HttpServletRequest request,HttpServletResponse response,Exception e)
|
||||
{
|
||||
log.error("ExceptionHandler(RuntimeException.class)",e);
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
String message = e.getMessage();
|
||||
if (null!=message && message.matches("^E:\\d{6}$")) {
|
||||
jsonResult.setCode(message.substring(2, 8));
|
||||
}else {
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public Object businessExceptionHandler(HttpServletRequest request, HttpServletResponse response, Exception e) {
|
||||
log.error("ExceptionHandler(RuntimeException.class)", e);
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
String message = e.getMessage();
|
||||
if (null != message && message.matches("^E:\\d{6}$")) {
|
||||
jsonResult.setCode(message.substring(2, 8));
|
||||
} else {
|
||||
jsonResult.setCode("800000");
|
||||
}
|
||||
jsonResult.setMessage("business exception");
|
||||
return jsonResult;
|
||||
}
|
||||
jsonResult.setMessage("business exception");
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Object exceptionHandler(HttpServletRequest request,HttpServletResponse response,Exception e)
|
||||
{
|
||||
log.error("ExceptionHandler(Exception.class)",e);
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setCode("900000");
|
||||
jsonResult.setMessage("exception");
|
||||
return jsonResult;
|
||||
}
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Object exceptionHandler(HttpServletRequest request, HttpServletResponse response, Exception e) {
|
||||
log.error("ExceptionHandler(Exception.class)", e);
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setCode("900000");
|
||||
jsonResult.setMessage("exception");
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user