tree: 3326a3a1e90e0fc3bc6ee380c2e9301e24d2683e [path history] [tgz]
  1. client/
  2. server/
  3. README.md
examples/features/error_handling/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.