Skip to content

Commit 0cbb73c

Browse files
divinity76ndeloof
authored andcommitted
Improve error message to include expected network label
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]>
1 parent 38e3d67 commit 0cbb73c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/compose/create.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,13 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
12081208
"Set `external: true` to use an existing network", n.Name, expectedProjectLabel)
12091209
}
12101210
if inspect.Labels[api.NetworkLabel] != expectedNetworkLabel {
1211-
return fmt.Errorf("network %s was found but has incorrect label %s set to %q", n.Name, api.NetworkLabel, inspect.Labels[api.NetworkLabel])
1211+
return fmt.Errorf(
1212+
"network %s was found but has incorrect label %s set to %q (expected: %q)",
1213+
n.Name,
1214+
api.NetworkLabel,
1215+
inspect.Labels[api.NetworkLabel],
1216+
expectedNetworkLabel,
1217+
)
12121218
}
12131219
return nil
12141220
}

0 commit comments

Comments
 (0)