|
|
@@ -27,22 +27,8 @@ public class ExceptionHandlerAdvice {
|
|
|
@ExceptionHandler(RuntimeException.class)
|
|
|
public ResponseEntity<ModelMap> handleRuntimeException(RuntimeException ex) {
|
|
|
logger.error("RuntimeException", ex);
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
- return new ResponseEntity<ModelMap>(error("出现异常"), headers, HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 允许用户看见的异常信息,直接传递给客户端
|
|
|
- *
|
|
|
- * @param ex 允许用户看见的异常信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ExceptionHandler({VisibleError.class, IllegalArgumentException.class})
|
|
|
- public ResponseEntity<ModelMap> handleVisibleError(RuntimeException ex) {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Content-Type", "application/json; charset=utf-8");
|
|
|
return new ResponseEntity<ModelMap>(error(ex.getMessage()), headers, HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
}
|