kohheepeace / mr-pdf

Generate PDF for document website.
https://www.npmjs.com/package/mr-pdf
MIT License
125 stars 41 forks source link

Expose headless mode option to supported flags for debugging. #65

Closed Zenahr closed 1 year ago

Zenahr commented 1 year ago

I'm running into an issue where the error doesn't tell me much. It would be awesome if I could run the PDF generation command and observe puppeteer. That way, I can talk if it has trouble with navigation or getting to the initial page.

Zenahr commented 1 year ago

Related to #66 but not really needed. It might make sense to throw a more descriptive error in known error cases. So instead of e.g.

Error: Protocol error (Page.navigate): Cannot navigate to invalid URL
    at C:\Users\Zenahr\AppData\Local\npm-cache\_npx\f49524b68d136ed3\node_modules\puppeteer\lib\Connection.js:183:56
    at new Promise (<anonymous>)

You could perhaps print out what URL was being tried to navigate to if possible and an instruction text such as "Your navigation selector might be out of date. Check your paginationSelector parameter.

Zenahr commented 1 year ago

Obsolete as the reason for the bug was that the specified cover image could not be retrieved via a HTTP request. See #66