mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
[api-minor] Reject the RenderTask
with an actual Error
, instead of 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.
This commit is contained in:
parent
6d672c4ba6
commit
d37d271afa
7 changed files with 66 additions and 8 deletions
|
@ -173,6 +173,19 @@ var CustomStyle = (function CustomStyleClosure() {
|
|||
return CustomStyle;
|
||||
})();
|
||||
|
||||
var RenderingCancelledException = (function RenderingCancelledException() {
|
||||
function RenderingCancelledException(msg, type) {
|
||||
this.message = msg;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
RenderingCancelledException.prototype = new Error();
|
||||
RenderingCancelledException.prototype.name = 'RenderingCancelledException';
|
||||
RenderingCancelledException.constructor = RenderingCancelledException;
|
||||
|
||||
return RenderingCancelledException;
|
||||
})();
|
||||
|
||||
var hasCanvasTypedArrays;
|
||||
if (typeof PDFJSDev === 'undefined' ||
|
||||
!PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
|
||||
|
@ -337,6 +350,7 @@ exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
|
|||
exports.isValidUrl = isValidUrl;
|
||||
exports.getFilenameFromUrl = getFilenameFromUrl;
|
||||
exports.LinkTarget = LinkTarget;
|
||||
exports.RenderingCancelledException = RenderingCancelledException;
|
||||
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
|
||||
exports.getDefaultSetting = getDefaultSetting;
|
||||
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue