Skip to content
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

More robust getPage() error handling. #8746

Merged
merged 1 commit into from
Aug 4, 2017

Conversation

yurydelendik
Copy link
Contributor

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 4, 2017

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/28fd883f5e8450d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 4, 2017

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/28fd883f5e8450d/output.txt

Total script time: 2.33 mins

Published

@@ -251,6 +251,10 @@ class PDFFindController {
// Store the pageContent as a string.
this.pageContents[i] = strBuf.join('');
extractTextCapability.resolve(i);
}, (reason) => {
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Aug 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most places in the patch you're using }).catch((reason) => {, but not here[1].
Just to satisfy my own curiosity: Is there a particular reason for not using that format here as well?


[1] I'm aware that there's a difference in behaviour between the two formats, since }, (reason) => { will only catch errors from the original promise whereas }).catch((reason) => { will also catch errors from the function inside of the then() above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exact science. Mostly I'm doing it by observation of then-handler: 1) if there is a logic that will cause exception or return a promise -- .catch() will be used; 2) however if logic have some simple finalization code thus no reason for exception, I'm trying to fit into then-catch-handler, it will avoid to perform additional micro task spawning.

@@ -387,6 +387,11 @@ class PDFViewer {
if (--getPagesLeft === 0) {
pagesCapability.resolve();
}
}, (reason) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brendandahl
Copy link
Contributor

Can we add console.error logs to all the places where we consume the rejections/exceptions? Previously, you'd at least see an unhandled promise rejection error to know something went wrong.

@yurydelendik
Copy link
Contributor Author

Can we add console.error logs to all the places where we consume the rejections/exceptions?

Added few console.error

@brendandahl brendandahl merged commit 1419b7f into mozilla:master Aug 4, 2017
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
More robust getPage() error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants