| | |
| | | import org.springframework.web.multipart.MultipartException; |
| | | import org.springframework.web.servlet.NoHandlerFoundException; |
| | | import org.springframework.web.servlet.resource.NoResourceFoundException; |
| | | import org.springdoc.api.OpenApiResourceNotFoundException; |
| | | import tools.jackson.databind.exc.InvalidFormatException; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | if (ex instanceof NoResourceFoundException) { |
| | | return noResourceFoundExceptionHandler(request, (NoResourceFoundException) ex); |
| | | } |
| | | // /v3/api-docs/{group} 传入不存在的分组:属于资源不存在,应返回 404 而不是 500 |
| | | if (ex instanceof OpenApiResourceNotFoundException) { |
| | | log.warn("[openApiResourceNotFoundExceptionHandler][{}]", ex.getMessage()); |
| | | return CommonResult.error(NOT_FOUND.getCode(), "接口分组不存在: " + ex.getMessage()); |
| | | } |
| | | if (ex instanceof HttpRequestMethodNotSupportedException) { |
| | | return httpRequestMethodNotSupportedExceptionHandler((HttpRequestMethodNotSupportedException) ex); |
| | | } |