v6: Throw WeaviateApiException for error status codes #437
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #403
This PR adds explicit error handling logic to the HTTP and gRPC transport. Previously both would either "swallow" a bad status code entirely or leak the internals by throwing something like
io.grpc.StatusRuntimeException
, which made error handling difficult or, at times, impossible.While error handling is transparent in the sense that both gRPC and HTTP transports throw the same WeaviateApiException, users may still encounter an
IOException
thrown by the HTTP transport. At the moment we do not catch/wrap it, because those errors would not be Weaviate-specific (e.g. timeout, connection reset by peer, etc) and are better handled separately.HTTP requests
gRPC Requests
Pagination
WeaviatePaginationException preserves information about the
pageSize
and the lastcursor
used. The original exception is accessible viae.getCause()
(can be WeaviateApiException or some other IOException).Endpoint utility classes
Inspired by Elasticsearch's
Endpoint
pattern, the new SimpleEndpoint, OptionalEndpoint, and BinaryEndpoint reduce boilerplate in how HTTP requests are defined.Removed deprecated
vectorizeClassName
parameterUsing this parameter is highly discouraged. We remove it from all vectorizers but one, text2vec-contextionary, because Weaviate will default to
true
, which does not allow creating collections with underscores in their names. That's annoying, so we make it read-only in the public API and always sendfalse
in the request.