grpc / grpc/grpc-rust

`tonic-types` should add case to handle unknown custom error details

Open
#2,287 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

## Feature Request

### Crates

`tonic-types`

### Motivation

Currently if a error details type URL is not recognized, it is dropped on the floor and not included in the array of error details messages:

https://github.com/hyperium/tonic/blob/689a86dbad107fa721714bb02e7f8e39264a377d/tonic-types/src/richer_error/mod.rs#L838-L841

According to [Google AIP 193](https://github.com/aip-dev/google.aip.dev/blob/becf861c4d97ed7ed0ba4206c8945184ce3cdeff/aip/general/0193.md?plain=1#L75-L77), `Status::details` **should**, not must, use the standard detail payloads.

### Proposal

- Add a list container to hold the unknown error details serialized bytes in [`ErrorDetails`](https://github.com/hyperium/tonic/blob/689a86dbad107fa721714bb02e7f8e39264a377d/tonic-types/src/richer_error/error_details/mod.rs#L17-L47).
- Add a function to return `Option` of the custom error details by URL

### Alternatives

Considered just returning the raw bytes instead of `Any` in case the user uses `prost-wkt-types::Any`, or some other implementation, but it probably doesn't matter since it should be trivial to convert the type.

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.