mport cn.fangxinqian.api.common.enums.CodeEnum;
    import cn.fangxinqian.api.common.result.ResultVO;
    import cn.fangxinqian.api.identity.exception.*;
    import io.jsonwebtoken.ExpiredJwtException;
    import io.jsonwebtoken.SignatureException;
    import lombok.extern.slf4j.Slf4j;
    import org.springframework.web.HttpRequestMethodNotSupportedException;
    import org.springframework.web.bind.annotation.ExceptionHandler;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.web.bind.annotation.RestControllerAdvice;

    @RestControllerAdvice
    @Slf4j
    public class GlobalExceptionHandler {

    1. private ExpiredJwtException e;
    2. @ExceptionHandler(value = ApiException.class)<br /> public ResultVO handApiException(ApiException e) {<br /> return e.getResult();<br /> }
    3. @ExceptionHandler(value = BeforeApiException.class)<br /> public ResultVO handApiException(BeforeApiException e) {<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
    4. @ExceptionHandler(value = BankCardOverLimitedException.class)<br /> public ResultVO handleException(BankCardOverLimitedException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
    5. @ExceptionHandler(value = ParameterErrorException.class)<br /> public ResultVO handleException(ParameterErrorException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
    6. @ExceptionHandler(HttpRequestMethodNotSupportedException.class)<br /> public ResultVO error(HttpRequestMethodNotSupportedException e){<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._HTTP_METHOD_NOT_ALLOW_);<br /> }
    7. @ExceptionHandler(FaceErrorException.class)<br /> public ResultVO error(FaceErrorException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
    8. @ExceptionHandler(value = Exception.class)<br /> public ResultVO handApiException(Exception e) {<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._SYSTEM_EXCEPTION_);<br /> }
    9. @ExceptionHandler(value = SignatureException.class)<br /> public ResultVO handApiException(SignatureException e) {<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._TOKEN_SIGN_ERROR_);<br /> }
    10. @ExceptionHandler(ExpiredJwtException.class)<br /> public ResultVO error(ExpiredJwtException e){<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._TOKEN_EXPIRE_);<br /> }

    }