Skip to content

Commit 146a496

Browse files
committed
Ensure original ErrNotFound is wrapped on BSD
1 parent 2d60206 commit 146a496

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

browser_freebsd.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package browser
22

33
import (
44
"errors"
5+
"fmt"
56
"os/exec"
67
)
78

89
func openBrowser(url string) error {
910
err := runCmd("xdg-open", url)
10-
if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
11-
return errors.New("xdg-open: command not found - install xdg-utils from ports(8)")
11+
if errors.Is(err, exec.ErrNotFound) {
12+
return fmt.Errorf("%w - install xdg-utils from ports(8)", err)
1213
}
1314
return err
1415
}

browser_openbsd.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package browser
22

33
import (
44
"errors"
5+
"fmt"
56
"os/exec"
67
)
78

89
func openBrowser(url string) error {
910
err := runCmd("xdg-open", url)
10-
if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
11-
return errors.New("xdg-open: command not found - install xdg-utils from ports(8)")
11+
if errors.Is(err, exec.ErrNotFound) {
12+
return fmt.Errorf("%w - install xdg-utils from ports(8)", err)
1213
}
1314
return err
1415
}

0 commit comments

Comments
 (0)