MCPcopy Create free account
hub / github.com/cockroachdb/errors / Echo

Method Echo

grpc/server_test.go:19–34  ·  view source on GitHub ↗
(ctx context.Context, req *EchoRequest)

Source from the content-addressed store, hash-verified

17}
18
19func (srv *EchoServer) Echo(ctx context.Context, req *EchoRequest) (*EchoReply, error) {
20 msg := req.Text
21 switch {
22 case msg == "noecho":
23 return nil, ErrCantEcho
24 case len(msg) > 10:
25 return nil, errors.WithMessage(ErrTooLong, msg+" is too long")
26 case msg == "reverse":
27 return nil, status.Error(codes.Unimplemented, "reverse is not implemented")
28 case msg == "internal":
29 return nil, status.WrapErr(codes.Internal, "there was a problem", ErrInternal)
30 }
31 return &EchoReply{
32 Reply: "echoing: " + msg,
33 }, nil
34}

Callers

nothing calls this directly

Calls 3

WithMessageFunction · 0.92
ErrorFunction · 0.92
WrapErrFunction · 0.92

Tested by

no test coverage detected