增加角色权限不足捕获
This commit is contained in:
@@ -2,6 +2,7 @@ package com.czg.exception;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.exception.NotRoleException;
|
||||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import com.czg.resp.CzgRespCode;
|
||||
import com.czg.resp.CzgResult;
|
||||
@@ -68,6 +69,14 @@ public class CzgControllerAdvice {
|
||||
return CzgResult.failure(CzgRespCode.UN_PERMISSION);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = NotRoleException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public CzgResult<Object> notRoleErrorHandler(NotRoleException ex) {
|
||||
setErrorLog(ex);
|
||||
return CzgResult.failure(CzgRespCode.UN_ROLE);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
|
||||
Reference in New Issue
Block a user