UnaryServerInterceptor makes sure that returned TTN errors contain a CorrelationID.
()
| 113 | |
| 114 | // UnaryServerInterceptor makes sure that returned TTN errors contain a CorrelationID. |
| 115 | func UnaryServerInterceptor() grpc.UnaryServerInterceptor { |
| 116 | return func( |
| 117 | ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, |
| 118 | ) (any, error) { |
| 119 | res, err := handler(ctx, req) |
| 120 | if ttnErr, ok := From(err); ok { |
| 121 | err = ttnErr |
| 122 | } |
| 123 | return res, err |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // StreamServerInterceptor makes sure that returned TTN errors contain a CorrelationID. |
| 128 | func StreamServerInterceptor() grpc.StreamServerInterceptor { |