GRPC Programming Model: Difference between revisions
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
[[GRPC_Concepts#Dial_Options|Dial Options]]. | [[GRPC_Concepts#Dial_Options|Dial Options]]. | ||
=Error Handling= | |||
Use https://pkg.go.dev/google.golang.org/grpc/internal/status | |||
gRPC service handlers should return error created by the <code>status</code> package, and gRPC clients should expect a corresponding error to be returned from the RPC call. | |||
<syntaxhighlight lang='go'> | |||
ErrClientConnClosing = status.Error(codes.Canceled, "grpc: the client connection is closing") | |||
</syntaxhighlight> |
Revision as of 20:36, 20 August 2024
Internal
Instantiate a GRPC Client
A Client Invocation
The generated typed client contains a cc
reference to google.golang.org/grpc
ClientConn
instance, which implements ClientConnInterface
.
When a typed invocation is made, cc
is invoked as such:
cc.Invoke(ctx, "/blue.service.quota.v1.QuotaService/SomeMethod", in, out, opts)
Error Handling
Use https://pkg.go.dev/google.golang.org/grpc/internal/status
gRPC service handlers should return error created by the status
package, and gRPC clients should expect a corresponding error to be returned from the RPC call.
ErrClientConnClosing = status.Error(codes.Canceled, "grpc: the client connection is closing")