Skip to content

Commit

Permalink
better error info
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Apr 28, 2022
1 parent 36f91ea commit f95d3d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/launcher/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ func (lc *Browser) Download() (err error) {

u, err := lc.fastestHost()
utils.E(err)

if u == "" {
panic(fmt.Errorf("[launcher] Can't find a browser binary for your OS, the doc might help https://go-rod.github.io/#/compatibility?id=os"))
}

return lc.download(lc.Context, u)
}

Expand Down
5 changes: 5 additions & 0 deletions lib/launcher/launcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func TestBrowserGet(t *testing.T) {
g := setup(t)

g.Nil(os.Stat(launcher.NewBrowser().MustGet()))

b := launcher.NewBrowser()
b.Revision = 0
_, err := b.Get()
g.Eq(err.Error(), "[launcher] Can't find a browser binary for your OS, the doc might help https://go-rod.github.io/#/compatibility?id=os")
}

func TestLaunch(t *testing.T) {
Expand Down

0 comments on commit f95d3d0

Please sign in to comment.