Skip to content

Commit 642c62b

Browse files
committed
Update release notes
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent bcdb8c1 commit 642c62b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

RELEASE_NOTES.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,37 @@
77
## Upgrading
88

99
- The client now uses a string URL to connect to the server, the `grpc_channel` and `target` arguments are now replaced by `server_url`. The current accepted format is `grpc://hostname[:<port:int=9090>][?ssl=<ssl:bool=false>]`, meaning that the `port` and `ssl` are optional and default to 9090 and `false` respectively. You will have to adapt the way you connect to the server in your code.
10+
1011
- The client is now using [`grpclib`](https://pypi.org/project/grpclib/) to connect to the server instead of [`grpcio`](https://pypi.org/project/grpcio/). You might need to adapt your code if you are using `grpcio` directly.
11-
- The client now doesn't raise `grpc.aio.RpcError` exceptions anymore. Instead, it raises `ClientError` exceptions that have the `grpclib.GRPCError` as their `__cause__`. You might need to adapt your error handling code to catch `ClientError` exceptions instead of `grpc.aio.RpcError` exceptions.
12+
13+
- The client now doesn't raise `grpc.aio.RpcError` exceptions anymore. Instead, it raises its own exceptions, one per gRPC error status code, all inheriting from `GrpcError`, which in turn inherits from `ClientError` (as any other exception raised by this library in the future). `GrpcError`s have the `grpclib.GRPCError` as their `__cause__`. You might need to adapt your error handling code to catch these specific exceptions instead of `grpc.aio.RpcError`.
14+
15+
You can also access the underlying `grpclib.GRPCError` using the `grpc_error` attribute for `GrpStatusError` exceptions, but it is discouraged because it makes downstream projects dependant on `grpclib` too
16+
1217
- The client now uses protobuf/grpc bindings generated [betterproto](https://github.com/danielgtaylor/python-betterproto) ([frequenz-microgrid-betterproto](https://github.com/frequenz-floss/frequenz-microgrid-betterproto-python)) instead of [grpcio](https://pypi.org/project/grpcio/) ([frequenz-api-microgrid](https://github.com/frequenz-floss/frequenz-api-microgrid)). If you were using the bindings directly, you might need to do some minor adjustments to your code.
1318

1419
## New Features
1520

16-
<!-- Here goes the main new features and examples or instructions on how to use them -->
21+
- The client now raises more specific exceptions based on the gRPC status code, so you can more easily handle different types of errors.
22+
23+
For example:
24+
25+
```python
26+
try:
27+
connections = await client.connections()
28+
except OperationTimedOut:
29+
...
30+
```
31+
32+
instead of:
33+
34+
```python
35+
try:
36+
connections = await client.connections()
37+
except grpc.aio.RpcError as e:
38+
if e.code() == grpc.StatusCode.DEADLINE_EXCEEDED:
39+
...
40+
```
1741

1842
## Bug Fixes
1943

0 commit comments

Comments
 (0)