|
@@ -28,4 +28,29 @@ public class ControllerExceptionHandler {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 没有权限
|
|
|
+ *
|
|
|
+ * @return 没权限
|
|
|
+ */
|
|
|
+ @ExceptionHandler(ForbiddenException.class)
|
|
|
+ @ResponseStatus(HttpStatus.FORBIDDEN)
|
|
|
+ public BaseResp forbiddenError(ForbiddenException ex) {
|
|
|
+ logger.warn("server error: ", ex);
|
|
|
+ return BaseResp.error(ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户没有登录
|
|
|
+ *
|
|
|
+ * @param ex 错误
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ExceptionHandler(UnauthorizedException.class)
|
|
|
+ @ResponseStatus(HttpStatus.UNAUTHORIZED)
|
|
|
+ public BaseResp unauthorizedError(UnauthorizedException ex) {
|
|
|
+ logger.warn("server error: ", ex);
|
|
|
+ return BaseResp.error(ex);
|
|
|
+ }
|
|
|
+
|
|
|
}
|