1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Convert the various image decoder ...Errors to classes extending BaseException (PR 11185 follow-up)

Somehow I missed these in PR 11185, but there's no good reason not to convert them as well.
This commit is contained in:
Jonas Jenwald 2019-10-01 13:10:14 +02:00
parent 8c4f4b5eec
commit 572abdcb4a
3 changed files with 22 additions and 54 deletions

View file

@ -14,44 +14,22 @@
*/
/* eslint-disable no-multi-spaces */
import { assert, warn } from '../shared/util';
import { assert, BaseException, warn } from '../shared/util';
let JpegError = (function JpegErrorClosure() {
function JpegError(msg) {
this.message = 'JPEG error: ' + msg;
class JpegError extends BaseException {
constructor(msg) {
super(`JPEG error: ${msg}`);
}
}
JpegError.prototype = new Error();
JpegError.prototype.name = 'JpegError';
JpegError.constructor = JpegError;
return JpegError;
})();
let DNLMarkerError = (function DNLMarkerErrorClosure() {
function DNLMarkerError(message, scanLines) {
this.message = message;
class DNLMarkerError extends BaseException {
constructor(message, scanLines) {
super(message);
this.scanLines = scanLines;
}
}
DNLMarkerError.prototype = new Error();
DNLMarkerError.prototype.name = 'DNLMarkerError';
DNLMarkerError.constructor = DNLMarkerError;
return DNLMarkerError;
})();
let EOIMarkerError = (function EOIMarkerErrorClosure() {
function EOIMarkerError(message) {
this.message = message;
}
EOIMarkerError.prototype = new Error();
EOIMarkerError.prototype.name = 'EOIMarkerError';
EOIMarkerError.constructor = EOIMarkerError;
return EOIMarkerError;
})();
class EOIMarkerError extends BaseException { }
/**
* This code was forked from https://github.com/notmasteryet/jpgjs.