MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / StreamServerInterceptor

Function StreamServerInterceptor

pkg/errors/grpc.go:128–138  ·  view source on GitHub ↗

StreamServerInterceptor makes sure that returned TTN errors contain a CorrelationID.

()

Source from the content-addressed store, hash-verified

126
127// StreamServerInterceptor makes sure that returned TTN errors contain a CorrelationID.
128func StreamServerInterceptor() grpc.StreamServerInterceptor {
129 return func(
130 srv any, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler,
131 ) error {
132 err := handler(srv, stream)
133 if ttnErr, ok := From(err); ok {
134 err = ttnErr
135 }
136 return err
137 }
138}
139
140// UnaryClientInterceptor converts gRPC errors to regular errors.
141func UnaryClientInterceptor() grpc.UnaryClientInterceptor {

Callers 2

NewFunction · 0.92
TestHooksFunction · 0.92

Calls 2

handlerFunction · 0.85
FromFunction · 0.85

Tested by 1

TestHooksFunction · 0.74