Skip to content

Commit

Permalink
return eval errors during export
Browse files Browse the repository at this point in the history
  • Loading branch information
zserge committed Dec 3, 2018
1 parent b4edb94 commit fc17d70
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions export.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const (
// you may use PageA4Width and PageA4Height constants.
func PDF(url, script string, width, height int) ([]byte, error) {
return doHeadless(url, func(c *chrome) ([]byte, error) {
c.eval(script)
if _, err := c.eval(script); err != nil {
return nil, err
}
return c.pdf(width, height)
})
}
Expand All @@ -35,7 +37,9 @@ func PDF(url, script string, width, height int) ([]byte, error) {
// for example when preparing Lorca app icons.
func PNG(url, script string, x, y, width, height int, bg uint32, scale float32) ([]byte, error) {
return doHeadless(url, func(c *chrome) ([]byte, error) {
c.eval(script)
if _, err := c.eval(script); err != nil {
return nil, err
}
return c.png(x, y, width, height, bg, scale)
})
}
Expand Down

0 comments on commit fc17d70

Please sign in to comment.