From dd094e401282e135989f57c0ca3dee7dea3f5207 Mon Sep 17 00:00:00 2001 From: Dominik Süß Date: Thu, 6 Feb 2025 12:14:37 +0100 Subject: [chore] update otel libraries (#3740) * chore: update otel dependencies * refactor: combine tracing & metrics in observability package * chore: update example tracing compose file --- .../grpc-ecosystem/grpc-gateway/v2/runtime/errors.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go') diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go index 01f573419..41cd4f503 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go @@ -81,6 +81,21 @@ func HTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.R mux.errorHandler(ctx, mux, marshaler, w, r, err) } +// HTTPStreamError uses the mux-configured stream error handler to notify error to the client without closing the connection. +func HTTPStreamError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, err error) { + st := mux.streamErrorHandler(ctx, err) + msg := errorChunk(st) + buf, err := marshaler.Marshal(msg) + if err != nil { + grpclog.Errorf("Failed to marshal an error: %v", err) + return + } + if _, err := w.Write(buf); err != nil { + grpclog.Errorf("Failed to notify error to client: %v", err) + return + } +} + // DefaultHTTPErrorHandler is the default error handler. // If "err" is a gRPC Status, the function replies with the status code mapped by HTTPStatusFromCode. // If "err" is a HTTPStatusError, the function replies with the status code provide by that struct. This is -- cgit v1.2.3