grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
861 stars 271 forks source link

Add custom trailers to GrpcError #493

Closed kengu closed 3 years ago

kengu commented 3 years ago

This PR resolves #135.

Background Servers can return additional error information as *Custom-Metadata in Trailers. These are not exposed in GrpcError making it practically impossible to implement typed exception handling in ClientInterceptors. Exposing trailers in error objects is supported in other implementations like csharp, and examples in the wild depends on custom trailers to communicate error information.

Tests A new test "Call should throw with custom trailers" is added to verify that custom headers only are exposed.

linux-foundation-easycla[bot] commented 3 years ago

CLA Signed

The committers are authorized under a signed CLA.

kengu commented 3 years ago

@ejona86 / @mit-mit This is my first PR to grpc-dart, so I hope I've followed all steps required for a review.

kengu commented 3 years ago

@mraleph Do you have time to look at this PR?

mraleph commented 3 years ago

@kengu I will try to find some time, maybe next week.

kengu commented 3 years ago

@kengu I will try to find some time, maybe next week.

Hi @mraleph, I'm currently testing this branch with a git-ref in pubspec.yaml, and it works as intended. I hope you find some time to make a review :pray:

kengu commented 3 years ago

@mraleph I see that dart format checks fails now. Running dart format --output=none --set-exit-if-changed . locally does not fail. It seems like the format error was introduced by one of the merges from master into my branch about 12 days ago, see https://github.com/grpc/grpc-dart/actions/workflows/dart.yml

mraleph commented 3 years ago

Trying to address it here: https://github.com/grpc/grpc-dart/pull/504

mraleph commented 3 years ago

d'oh. Now there is another problem with envoy package not available anymore through https://dl.bintray.com/tetrate/getenvoy-deb - unfortunately I don't think I will have enough time left in the day to fix this today. I will pick this up when I am back from sommerferien 🌴 in few weeks.

mraleph commented 3 years ago

@kengu could you try rebasing on top of master? I think CI should be green now.

mraleph commented 3 years ago

Thanks for the PR. Merged.

kengu commented 3 years ago

@mraleph Do you know when the next release of grpc-dart to pub.dev is scheduled? I still need this before I can publish my own packaged that depends on this change.

mraleph commented 3 years ago

Released 3.0.1