Skip to content

Commit

Permalink
Improve error message to include expected network label
Browse files Browse the repository at this point in the history
Updated the error message when a network is found with an incorrect label to also display the expected label value. This provides more context for debugging.

Signed-off-by: divinity76 <[email protected]>
  • Loading branch information
divinity76 authored and ndeloof committed Oct 15, 2024
1 parent 38e3d67 commit 0cbb73c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,13 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
"Set `external: true` to use an existing network", n.Name, expectedProjectLabel)
}
if inspect.Labels[api.NetworkLabel] != expectedNetworkLabel {
return fmt.Errorf("network %s was found but has incorrect label %s set to %q", n.Name, api.NetworkLabel, inspect.Labels[api.NetworkLabel])
return fmt.Errorf(
"network %s was found but has incorrect label %s set to %q (expected: %q)",
n.Name,
api.NetworkLabel,
inspect.Labels[api.NetworkLabel],
expectedNetworkLabel,
)
}
return nil
}
Expand Down

0 comments on commit 0cbb73c

Please sign in to comment.