登录鉴权按照Source判断id来自于何处
This commit is contained in:
@@ -18,6 +18,15 @@ import java.util.stream.Collectors;
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(UnauthorizedException.class)
|
||||
public ResponseEntity<Object> handleUnauthorizedException(UnauthorizedException e) {
|
||||
log.error("Unauthorized: {}", e.getMessage());
|
||||
return new ResponseEntity<>(
|
||||
Response.fail(401, e.getMessage()),
|
||||
HttpStatus.UNAUTHORIZED
|
||||
);
|
||||
}
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public Response<?> handleBusinessException(BusinessException e) {
|
||||
log.error("业务异常: code={}, msg={}", e.getCode(), e.getMsg());
|
||||
|
||||
Reference in New Issue
Block a user