New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.render() callback provides no error information on failure #290

Closed
cabeese opened this Issue Jul 12, 2015 · 2 comments

Comments

3 participants
@cabeese

cabeese commented Jul 12, 2015

I tried running page.render() to save a page to a .pdf document, and all is fine and good if it succeeds. However, I tried writing to a read-only directory (just to test my error handling), and there was no hint of a failure within the code. The callback passed to render() was called with no arguments, exactly as it would have been called if the file write had been successful. Here's what the code looks like:

page.render(".../some/file.pdf", function(arg){
    if(!arg){
        console.log("File was successfully saved as a PDF");
        // ...
    }
}

Regardless of whether or not the file is created, I always see "File was successfully saved as a PDF" in the console.

For now, I can check to make sure that the file is written after render() finishes, but is there any way to get a "status" argument (like page.open() has) for the page.render() method?

Node v0.12.1
phantomjs-node 0.7.2

Thanks in advance for your help and great work on this fantastic tool!

@FelixAkk

This comment has been minimized.

Show comment
Hide comment
@FelixAkk

FelixAkk Nov 10, 2015

+1

Another example case to produce this, is specifying a output render path with a filename extension other than .pdf. Simply omitting the extension will even crash it.

FelixAkk commented Nov 10, 2015

+1

Another example case to produce this, is specifying a output render path with a filename extension other than .pdf. Simply omitting the extension will even crash it.

@amir20

This comment has been minimized.

Show comment
Hide comment
@amir20

amir20 Feb 18, 2016

Owner

I have changed this behavior to make it more clear. You can do catch() from promise.

Owner

amir20 commented Feb 18, 2016

I have changed this behavior to make it more clear. You can do catch() from promise.

@amir20 amir20 closed this Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment