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
+4 -4
View File
@@ -125,10 +125,10 @@ func (cli *Client) InspectService(ctx context.Context, nameOrID string) (api.Ser
continue
}
if mc.Metadata.Error != "" {
if err := mc.Metadata.Err(); err != nil {
// TODO: return failed machines in the response.
tui.PrintWarning(fmt.Sprintf("failed to list containers on machine '%s': %s",
mc.Metadata.MachineName, mc.Metadata.Error))
mc.Metadata.MachineName, err))
continue
}
@@ -333,10 +333,10 @@ func (cli *Client) ListServices(ctx context.Context) ([]api.Service, error) {
// Group containers by service ID using the broadcast results.
servicesByID := make(map[string]api.Service)
for _, mc := range machineContainers {
if mc.Metadata.Error != "" {
if err := mc.Metadata.Err(); err != nil {
// TODO: return failed machines in the response.
tui.PrintWarning(fmt.Sprintf("failed to list containers on machine '%s': %s",
mc.Metadata.MachineName, mc.Metadata.Error))
mc.Metadata.MachineName, err))
continue
}