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

[api-minor] Reject the RenderTask with an actual Error, instead of just a string, when rendering is cancelled #8157

Merged
merged 3 commits into from
Apr 4, 2017
Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Mar 13, 2017

This patch gets rid of the only case in the code-base where we're throwing a plain string, rather than an Error, which besides better/more consistent error handling also allows us to enable the no-throw-literal ESLint rule.


This change is Reviewable

@yurydelendik
Copy link
Contributor

Hmm, that really falls under category [api-major]. At the moment I don't really see best way to resolve it. Can we introduce something like PDFJS.pdfjsNext = true; (with PDFJSDev.test("PDFJS_NEXT")) and start moving this features there with fallback to old ways?

… to allow backwards incompatible API changes
…f just a `string`, when rendering is cancelled

This patch gets rid of the only case in the code-base where we're throwing a plain `string`, rather than an `Error`, which besides better/more consistent error handling also allows us to enable the [`no-throw-literal`](http://eslint.org/docs/rules/no-throw-literal) ESLint rule.
There's still some work necessary if we want to be able to run (even a subset of) the API unit-tests on Travis.
However, this patch could be considered a small first step, since the relevant unit-tests will now rely on a `CanvasFactory` rather than using `document.createElement('canvas')` directly.
@Snuffleupagus
Copy link
Collaborator Author

Hmm, that really falls under category [api-major]. At the moment I don't really see best way to resolve it. Can we introduce something like PDFJS.pdfjsNext = true; (with PDFJSDev.test("PDFJS_NEXT")) and start moving this features there with fallback to old ways?

@yurydelendik Very good points, thank you!
I've pushed an updated PR that attempts to implement this, please let me know if it's more to your liking!

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/f16d203f4cd3c8e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/450b325ea2ae812/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/450b325ea2ae812/output.txt

Total script time: 22.33 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/f16d203f4cd3c8e/output.txt

Total script time: 28.18 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@yurydelendik yurydelendik merged commit 31f8875 into mozilla:master Apr 4, 2017
@yurydelendik
Copy link
Contributor

Thank you for the patch

@Snuffleupagus Snuffleupagus deleted the api-RenderTask-cancel-Error branch April 4, 2017 14:50
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…cel-Error

[api-minor] Reject the `RenderTask` with an actual `Error`, instead of just a `string`, when rendering is cancelled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants