Mutate errors at server level (intercepter counterpart)
- 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
Assessment
This issue has not been assessed yet.