|
@@ -1,12 +1,15 @@
|
|
package cn.hnthyy.thmz.interceptor;
|
|
package cn.hnthyy.thmz.interceptor;
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.R;
|
|
|
|
+import cn.hnthyy.thmz.common.exception.BizException;
|
|
import cn.hnthyy.thmz.entity.AuthException;
|
|
import cn.hnthyy.thmz.entity.AuthException;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -42,4 +45,10 @@ public class GlobalExceptionHandler {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ExceptionHandler(BizException.class)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public R handleRRException(BizException e){
|
|
|
|
+ return R.error(e.getCode(),e.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|