File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ package browser
22
33import (
44 "errors"
5+ "fmt"
56 "os/exec"
67)
78
89func 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}
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ package browser
22
33import (
44 "errors"
5+ "fmt"
56 "os/exec"
67)
78
89func 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}
You can’t perform that action at this time.
0 commit comments