adding tests for page ranges

This commit is contained in:
Julien Neuhart
2019-10-05 12:09:39 +02:00
parent 827060b6ce
commit ca0784fa59
7 changed files with 89 additions and 8 deletions

View File

@@ -161,15 +161,15 @@ func (p chromePrinter) Print(destination string) error {
printToPdfArgs.SetPageRanges(p.opts.PageRanges)
}
// print the page to PDF.
// TODO catch page range error?
print, err := targetClient.Page.PrintToPDF(
ctx,
printToPdfArgs,
)
if err != nil {
// TODO: find a way to check it in the handlers.
if strings.Contains(err.Error(), "Page range syntax error") {
return xerror.Invalid(
"",
op,
fmt.Sprintf("'%s' is not a valid Google Chrome page ranges", p.opts.PageRanges),
err,
)