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

This commit is contained in:
Pasha Sviderski
2026-10-28 20:24:16 +10:00
parent 7e8736fa99
commit bd695f65a3
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()