arachnys / athenapdf

Drop-in replacement for wkhtmltopdf built on Go, Electron and Docker
MIT License
2.26k stars 187 forks source link

'did-get-response-details' no longer functional #183

Closed romanseidl closed 5 years ago

romanseidl commented 5 years ago

For the system to react on errors on electron 3.

s. https://github.com/electron/electron/issues/12597

MrSaints commented 5 years ago

Judging from the docs, I'm not entirely sure this gives us exactly what we want since it seems like it only applies to the main frame?

romanseidl commented 5 years ago

I thought that this actually aims specifically at the main frame. The old source had an explicit check:

        if (resourceType === "mainFrame") {
            app.exit(1);
        }

This should now be obsolete, thus I removed the check. I tested it and it gives me an error if the page gives e.g. 404, which is important to me as I want to automatically generate pdfs from web pages and track those with errors.

If we want to target also a sub frame and then only issue a console.error maybe one would have to hook on other events such as 'did-frame-navigate'?

MrSaints commented 5 years ago

@romanseidl To be honest, the subframes are not crucial, but it was added for extra debugging. We do want to exit if the mainframe fails to load, but it would be nice to know what parts of the page failed to load.