libnetwork: Controller.NetworkByID: remove redundant error-handling

Controller.getNetworkFromStore() already returns a ErrNoSuchNetwork if
no network was found, so we don't need to convert the existing error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-16 16:24:09 +02:00
parent e3975fba84
commit 642cf261a8
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -863,13 +863,7 @@ func (c *Controller) NetworkByID(id string) (*Network, error) {
if id == "" {
return nil, ErrInvalidID(id)
}
n, err := c.getNetworkFromStore(id)
if err != nil {
return nil, ErrNoSuchNetwork(id)
}
return n, nil
return c.getNetworkFromStore(id)
}
// NewSandbox creates a new sandbox for containerID.