Skip to content

6.0.0-beta4 - Error Handling

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 13 Aug 14:38
· 811 commits to main since this release
e34e09a

This release introduces several exception types to facilitate error handling and propagation when working with client6.

For example, most of the methods which result in calling one of Weaviate's public APIs (REST and gRPC) will throw WeaviateApiException if an error response code is returned. You can get more information about the underlying error by calling its public methods, e.g. .httpStatusCode() or .getError().

Errors which occur during pagination are wrapped in PaginationException, which contains the information necessary to resume pagination.

try {
    things.paginate().forEach(page -> {...});
} catch (PaginationException e) {
    if (e.getCause() instanceof TimeoutException) {
        // There was a network latency spike, let's continue after a brief pause
        Thread.sleep(100);
        things.paginate(p -> p.fromCursor(e.getCursor()))
            .forEach(page -> {...});
    }
}

Finally, use WeaviateException to catch any exceptions thrown by Weaviate client.

Notice too, that checked IOException which all synchronous methods throw must be handled separately. They indicate errors that are not specific to Weaviate, such as bad network, failed TLS handshakes, etc.

Minor improvements

Starting with beta4, the shaded version of the library published under all classifier will have all of it's gRPC dependencies (io.grpc.* and com.google.protobuf.*) relocated to avoid version conflicts with user's own dependencies.

What's Changed

  • v6: Relocate gRPC dependencies in a shaded library version by @bevzzz in #439
  • v6: Throw WeaviateApiException for error status codes by @bevzzz in #437

Full Changelog: 6.0.0-beta3...6.0.0-beta4