Skip to content

Commit

Permalink
Add client exceptions (#55)
Browse files Browse the repository at this point in the history
Add a `ApiClientError` exception that is the base class for all client
exceptions. This exception is raised when there is an error in the
client. We also wrap all gRPC response errors in a `GrpcError` exception
that is a subclass of `ApiClientError`, and add one subclass for each
possible gRPC status code.

This makes error handling more pythonic, as one can now just catch the
exception type one is interested in, without having to do a second-level
matching using the status.

It also helps avoiding to expose the grpclib classes to the user.
  • Loading branch information
llucax authored May 31, 2024
2 parents dceac02 + 52ae05d commit 7cca5b2
Show file tree
Hide file tree
Showing 3 changed files with 940 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->
- Add a `exception` module to provide client exceptions, including gRPC errors with one subclass per gRPC error status code.

## Bug Fixes

Expand Down
Loading

0 comments on commit 7cca5b2

Please sign in to comment.