Skip to content

Commit 409345b

Browse files
authored
fix: throw error if no network/volume is found (fix: #38) (#39)
* fix: throw error if no network/volume is found (fix: #38) * feat: added also which network/volume was not found
1 parent af09767 commit 409345b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

driver.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ func (d *Driver) Create() error {
257257
if err != nil {
258258
return errors.Wrap(err, "could not get network by ID or name")
259259
}
260+
if network == nil {
261+
return errors.Errorf("network '%s' not found", networkIDorName)
262+
}
260263
networks = append(networks, network)
261264
}
262265
srvopts.Networks = networks
@@ -267,6 +270,9 @@ func (d *Driver) Create() error {
267270
if err != nil {
268271
return errors.Wrap(err, "could not get volume by ID or name")
269272
}
273+
if volume == nil {
274+
return errors.Errorf("volume '%s' not found", volumeIDorName)
275+
}
270276
volumes = append(volumes, volume)
271277
}
272278
srvopts.Volumes = volumes

0 commit comments

Comments
 (0)