17 changed files with 86 additions and 47 deletions
@ -0,0 +1,29 @@ |
|||
package com.yxt.yyth.config; |
|||
|
|||
import com.yxt.common.base.config.handler.GlobalExceptionHandler; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.validation.BindException; |
|||
import org.springframework.validation.BindingResult; |
|||
import org.springframework.validation.FieldError; |
|||
import org.springframework.web.bind.annotation.ExceptionHandler; |
|||
import org.springframework.web.bind.annotation.ResponseStatus; |
|||
import org.springframework.web.bind.annotation.RestControllerAdvice; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/9/12 3:23 |
|||
* @description 全局异常处理 |
|||
*/ |
|||
@RestControllerAdvice |
|||
public class SaTokenGloableException { |
|||
@ExceptionHandler({Exception.class}) |
|||
public ResultBean handleException(Exception e) { |
|||
if(e.getMessage().contains("token 无效:")){ |
|||
return ResultBean.fireFail().setCode("5000").setMsg("系统异常::" + e.getMessage()); |
|||
} |
|||
return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage()); |
|||
} |
|||
} |
Loading…
Reference in new issue