feat(types): Add gRPC Richer Error Model support (Examples) (#1300)

* types: remove unnecessary cloning from `ErrorDetails` getters

Breaking change.

* examples: add `richer-error` examples

Following implementation at flemosr/tonic-richer-error.
This commit is contained in:
Rafael Lemos
2023-03-14 15:26:35 +00:00
committed by GitHub
parent c8027a1385
commit d471212ee8
7 changed files with 325 additions and 21 deletions
+30
View File
@@ -153,3 +153,33 @@ The autoload example requires the following crates installed globally:
* [systemfd](https://crates.io/crates/systemfd)
* [cargo-watch](https://crates.io/crates/cargo-watch)
## Richer Error
Both clients and both servers do the same thing, but using the two different
approaches. Run one of the servers in one terminal, and then run the clients
in another.
### Client using the `ErrorDetails` struct
```bash
$ cargo run --bin richer-error-client
```
### Client using a vector of error message types
```bash
$ cargo run --bin richer-error-client-vec
```
### Server using the `ErrorDetails` struct
```bash
$ cargo run --bin richer-error-server
```
### Server using a vector of error message types
```bash
$ cargo run --bin richer-error-server-vec
```