全局异常捕捉
This commit is contained in:
parent
210a3023c7
commit
eaaa5bd313
|
|
@ -1,16 +1,23 @@
|
|||
package com.ruoyi.auth;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* 认证授权中心
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringCloudApplication
|
||||
@ControllerAdvice
|
||||
public class RuoYiAuthApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
@ -27,4 +34,11 @@ public class RuoYiAuthApplication
|
|||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R<?> exceptionHandler(Exception e) {
|
||||
e.printStackTrace();
|
||||
return R.failed(e,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue