grpc-go/examples/features/error_handling
Elisha Silas 09e6fddbcd
Update docs and examples and tests to use NewClient instead of Dial (#7068)
Co-authored-by: Arvind Bright <arvind.bright100@gmail.com>
Co-authored-by: Doug Fawley <dfawley@google.com>
2024-04-19 10:55:23 -07:00
..
client Update docs and examples and tests to use NewClient instead of Dial (#7068) 2024-04-19 10:55:23 -07:00
server examples: add error_handling example; move errors to error_details (#6293) 2023-05-17 14:57:56 -07:00
README.md examples: add error_handling example; move errors to error_details (#6293) 2023-05-17 14:57:56 -07:00

README.md

Description

This example demonstrates basic RPC error handling in gRPC.

Run the sample code

Run the server, which returns an error if the RPC request's Name field is empty.

$ go run ./server/main.go

Then run the client in another terminal, which does two requests: one with an empty Name field and one with it populated with the current username provided by os/user.

$ go run ./client/main.go

It should print the status codes it received from the server.