| 1 |
# Errors and Cancelletion code samples for grpc-ruby |
| 2 |
|
| 3 |
The examples in this directory show use of grpc errors. |
| 4 |
|
| 5 |
On the server side, errors are returned from service |
| 6 |
implementations by raising a certain `GRPC::BadStatus` exception. |
| 7 |
|
| 8 |
On the client side, GRPC errors get raised when either: |
| 9 |
* the call completes (unary and client-streaming call types) |
| 10 |
* the response `Enumerable` is iterated through (server-streaming and |
| 11 |
bidi call types). |
| 12 |
|
| 13 |
## To run the examples here: |
| 14 |
|
| 15 |
Start the server: |
| 16 |
|
| 17 |
``` |
| 18 |
> ruby error_examples_server.rb |
| 19 |
``` |
| 20 |
|
| 21 |
Then run the client: |
| 22 |
|
| 23 |
``` |
| 24 |
> ruby error_examples_client.rb |
| 25 |
``` |