mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Optimized RoleManagement, GroupManagement and UserManagement
This commit is contained in:
@@ -22,6 +22,7 @@ public class ResponseCode {
|
||||
public static final int DATABASE_DELETE_ERROR = 20034;
|
||||
public static final int DATABASE_TIMEOUT_ERROR = 20035;
|
||||
public static final int DATABASE_CONNECT_ERROR = 20036;
|
||||
public static final int DATABASE_DATA_TO_LONG = 20037;
|
||||
|
||||
public static final int UNAUTHORIZED = 30010;
|
||||
public static final int ACCESS_DENIED = 30030;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.cfive.pinnacle.handler;
|
||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
@@ -28,6 +29,9 @@ public class CustomExceptionHandler {
|
||||
if (e instanceof DisabledException) {
|
||||
return ResponseResult.build(ResponseCode.USER_DISABLE, e.getMessage(), null);
|
||||
}
|
||||
if (e instanceof DataIntegrityViolationException) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DATA_TO_LONG, e.getMessage(), null);
|
||||
}
|
||||
|
||||
log.debug(e.getMessage(), e);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user