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

Loading…
Cancel
Save