Skip to content

Commit

Permalink
fix(interface): Handle nonexistent interfaces gracefully (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg authored Oct 27, 2024
1 parent 3290757 commit 245b206
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/metadata/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ func (d *DeviceCache) GetDevices(devNames []string, netNsPaths []string) (*types
for _, ns := range nsList {
for _, name := range devNames {
dev, err := d.getDeviceFromNetNs(name, ns)
if err != nil && !errors.Is(err, types.ErrDeviceNotFound) {
return nil, err
if err != nil {
if !errors.Is(err, types.ErrDeviceNotFound) {
return nil, err
}
return nil, fmt.Errorf("%s: No such device exists", name)
}
interfaces.Add(*dev)
}
Expand Down

0 comments on commit 245b206

Please sign in to comment.