mirror of https://github.com/docker/compose.git
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 <hans@loltek.net>
This commit is contained in:
parent
38e3d670a9
commit
0cbb73c024
|
@ -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)
|
"Set `external: true` to use an existing network", n.Name, expectedProjectLabel)
|
||||||
}
|
}
|
||||||
if inspect.Labels[api.NetworkLabel] != expectedNetworkLabel {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue