Browse Source

修改输出所有异常

master
xyiege 4 years ago
parent
commit
898af88dab
  1. 8
      src/main/java/cn/chjyj/szwh/controller/GlobalErrorController.java

8
src/main/java/cn/chjyj/szwh/controller/GlobalErrorController.java

@ -23,10 +23,10 @@ public class GlobalErrorController {
*/ */
@ExceptionHandler(ChException.class) @ExceptionHandler(ChException.class)
@ResponseBody @ResponseBody
public JSONObject aisHandler(ChException ais){ public JSONObject aisHandler(ChException ex){
log.error("Exception:"+ais); log.error("Exception:"+ex);
jsonObject.put("code",500); jsonObject.put("code",500);
jsonObject.put("msg",ais.getMsg()); jsonObject.put("msg",ex.getMsg());
return jsonObject; return jsonObject;
} }
@ -38,7 +38,7 @@ public class GlobalErrorController {
@ExceptionHandler(value =NullPointerException.class) @ExceptionHandler(value =NullPointerException.class)
@ResponseBody @ResponseBody
public JSONObject exceptionHandler(NullPointerException e){ public JSONObject exceptionHandler(NullPointerException e){
log.error("空指针异常:"+e.getStackTrace()); log.error("空指针异常:"+e);
String msg = e.getMessage()==null?"module not found!":e.getMessage(); String msg = e.getMessage()==null?"module not found!":e.getMessage();
jsonObject.put("code",500); jsonObject.put("code",500);
jsonObject.put("msg",msg); jsonObject.put("msg",msg);

Loading…
Cancel
Save