mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 00:57:13 +08:00 
			
		
		
		
	feat: 全局异常处理器添加 BaseException 处理
This commit is contained in:
		| @@ -32,6 +32,7 @@ import org.springframework.web.method.annotation.MethodArgumentTypeMismatchExcep | ||||
| import org.springframework.web.multipart.MultipartException; | ||||
| import org.springframework.web.servlet.NoHandlerFoundException; | ||||
| import top.continew.starter.core.exception.BadRequestException; | ||||
| import top.continew.starter.core.exception.BaseException; | ||||
| import top.continew.starter.core.exception.BusinessException; | ||||
| import top.continew.starter.web.model.R; | ||||
|  | ||||
| @@ -47,6 +48,16 @@ import top.continew.starter.web.model.R; | ||||
| @RestControllerAdvice | ||||
| public class GlobalExceptionHandler { | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 自定义基类异常 | ||||
|      */ | ||||
|     @ExceptionHandler(BaseException.class) | ||||
|     public R handleBaseException(BaseException e, HttpServletRequest request) { | ||||
|         log.error("[{}] {}", request.getMethod(), request.getRequestURI(), e); | ||||
|         return R.fail(String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR.value()), e.getMessage()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 业务异常 | ||||
|      */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 danaodai
					danaodai