Created
November 29, 2018 20:10
-
-
Save ncdc/9b648221eb0975938337ca7252133426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (s *server) run() error { | |
// do things | |
widget, err := widgetClient.Foo("abc") | |
if err != nil { | |
// QUESTION: what should the top of the stack be (what line)? | |
optionallyLogStackAtDebugLogLevel(err) | |
// other error handling | |
} | |
} | |
func (c *WidgetGRPCClient) Foo(s string) (Widget, error) { | |
response, err := c.grpcClient.Foo(context.Background(), &proto.FooRequest{S: s}) | |
if err != nil { | |
return nil, convertGRPCError(err) | |
} | |
// ... | |
} | |
func (s *WidgetGRPCServer) Foo(ctx context.Context, req *proto.FooRequest) (*proto.FooResponse, error) { | |
widget, err := s.widgetImpl.Foo(req.S) | |
if err != nil { | |
return nil, toGRPCError(err) | |
} | |
// ... | |
} | |
func (w *widgetImpl) Foo(s string) (Widget, error) { | |
// do stuff | |
// oh no, an error! | |
return nil, newBadWidgetError() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment