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 {
private ExpiredJwtException e;
@ExceptionHandler(value = ApiException.class)<br /> public ResultVO handApiException(ApiException e) {<br /> return e.getResult();<br /> }
@ExceptionHandler(value = BeforeApiException.class)<br /> public ResultVO handApiException(BeforeApiException e) {<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
@ExceptionHandler(value = BankCardOverLimitedException.class)<br /> public ResultVO handleException(BankCardOverLimitedException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
@ExceptionHandler(value = ParameterErrorException.class)<br /> public ResultVO handleException(ParameterErrorException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)<br /> public ResultVO error(HttpRequestMethodNotSupportedException e){<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._HTTP_METHOD_NOT_ALLOW_);<br /> }
@ExceptionHandler(FaceErrorException.class)<br /> public ResultVO error(FaceErrorException e){<br /> e.printStackTrace();<br /> return e.getResult();<br /> }
@ExceptionHandler(value = Exception.class)<br /> public ResultVO handApiException(Exception e) {<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._SYSTEM_EXCEPTION_);<br /> }
@ExceptionHandler(value = SignatureException.class)<br /> public ResultVO handApiException(SignatureException e) {<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._TOKEN_SIGN_ERROR_);<br /> }
@ExceptionHandler(ExpiredJwtException.class)<br /> public ResultVO error(ExpiredJwtException e){<br /> e.printStackTrace();<br /> return ResultVO._error_(CodeEnum._TOKEN_EXPIRE_);<br /> }
}