fix: report history storage availability clearly
This commit is contained in:
@@ -8,7 +8,9 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeParseException;
|
||||
@@ -69,6 +71,18 @@ public final class ApiExceptionHandler {
|
||||
return error(HttpStatus.BAD_REQUEST, "invalid date/time parameter: " + ex.getParsedString(), request);
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoResourceFoundException.class)
|
||||
public ResponseEntity<ApiError> noResource(NoResourceFoundException ex,
|
||||
HttpServletRequest request) {
|
||||
return error(HttpStatus.NOT_FOUND, "resource not found: " + request.getRequestURI(), request);
|
||||
}
|
||||
|
||||
@ExceptionHandler(IOException.class)
|
||||
public ResponseEntity<ApiError> io(IOException ex,
|
||||
HttpServletRequest request) {
|
||||
return error(HttpStatus.SERVICE_UNAVAILABLE, safeMessage(ex, "history storage unavailable"), request);
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<ApiError> generic(Exception ex,
|
||||
HttpServletRequest request) {
|
||||
|
||||
Reference in New Issue
Block a user