@RestControllerAdvice(basePackages ="xx.xxx")
public class GlobalExceptionHandlerextends ResponseEntityExceptionHandler {
private static final Loglogger = LogFactory.getLog(GlobalExceptionHandler.class);
@ExceptionHandler(value = Exception.class)
public ResulterrorHandler(Exception ex) {
String msg;
msg = ex.getMessage();
if (msg ==null || msg.length() ==0) {
msg ="xxxxxxx";
}
ex.printStackTrace();
return Result.error(msg);
}
}
网友评论