This commit is contained in:
shikong 2024-04-18 01:45:23 +08:00
parent 079179629b
commit 171dea5525

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.async.AsyncRequestTimeoutException;
import org.springframework.web.servlet.resource.NoResourceFoundException;
import java.util.Objects;
@ -83,6 +84,11 @@ public class ExceptionAdvice {
return JsonResponse.error("请求超时");
}
@ExceptionHandler(NoResourceFoundException.class)
public JsonResponse<String> exception(NoResourceFoundException e) {
return JsonResponse.error(e.getMessage());
}
@ExceptionHandler(NullPointerException.class)
public JsonResponse<String> exception(NullPointerException e) {
e.printStackTrace();