Exception 强转 BusinessException 不成功 java.lang.ClassCastException: java.lang.NullPointerException cannot be cast to com.dmsc.error.BusinessException at com.dmsc.conrtoller.UserConrtoller.handlerException(UserConrtoller.java:46) ~[classes/:na]
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public Object handlerException(HttpServletRequest repuest,Exception ex){
BusinessException businessException = (BusinessException) ex;
CommonReyurnType type = new CommonReyurnType();
/* Map<String, Object> map = new HashMap<>();
map.put("errcode", businessException.getErrCode());
map.put("errmsg", businessException.getErrMsg());*/
type.setStatus("fail");
type.setData(ex);
return type;
}