grpc / grpc/grpc-rust

Mutate errors at server level (intercepter counterpart)

Open
#2,485 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

I _think_ I'm looking for something like [Interceptor](https://docs.rs/tonic/latest/tonic/service/interceptor/trait.Interceptor.html) except I want to intercept the `Response` and not the `Request`.

Essentially I'd like to inspect the gRPC error (if any) and ensure it does not contain sensitive information. As an example, wiping the error message if the code indicates internal error. This would be much easier to do as a tower layer; at the moment we're manually ensuring this is the case in every error variant and mapping, however this isn't possible to properly police or enforce.

We also have internal gRPC services for which we _don't_ want to wipe the error details. However in some cases our public service simply redirects to our internal service and then we have to ensure we wipe the error before proxying the response on.

I though [recover_error](https://docs.rs/tonic/latest/tonic/service/recover_error/index.html) might do the trick but it appears to be an internal thing?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.