refactor(grpc-proxy): use Metadata.Err() method to get upstream error for a broadcasted request

This commit is contained in:
Pasha Sviderski
2026-10-27 10:05:35 +10:00
parent bb8fb3a380
commit fab2a20242
9 changed files with 28 additions and 28 deletions
+8
View File
@@ -4,8 +4,16 @@ import (
"bytes"
"fmt"
"net/netip"
"google.golang.org/grpc/status"
)
// Err returns the upstream error, preserving its gRPC status code.
// It returns nil for nil metadata or an absent or successful status.
func (m *Metadata) Err() error {
return status.ErrorProto(m.GetStatus())
}
func NewIP(addr netip.Addr) *IP {
// MarshalBinary always returns a nil error.
ip, _ := addr.MarshalBinary()