|
14 | 14 | */ |
15 | 15 | /* eslint-disable no-multi-spaces */ |
16 | 16 |
|
17 | | -import { assert, warn } from '../shared/util'; |
| 17 | +import { assert, BaseException, warn } from '../shared/util'; |
18 | 18 |
|
19 | | -let JpegError = (function JpegErrorClosure() { |
20 | | - function JpegError(msg) { |
21 | | - this.message = 'JPEG error: ' + msg; |
| 19 | +class JpegError extends BaseException { |
| 20 | + constructor(msg) { |
| 21 | + super(`JPEG error: ${msg}`); |
22 | 22 | } |
| 23 | +} |
23 | 24 |
|
24 | | - JpegError.prototype = new Error(); |
25 | | - JpegError.prototype.name = 'JpegError'; |
26 | | - JpegError.constructor = JpegError; |
27 | | - |
28 | | - return JpegError; |
29 | | -})(); |
30 | | - |
31 | | -let DNLMarkerError = (function DNLMarkerErrorClosure() { |
32 | | - function DNLMarkerError(message, scanLines) { |
33 | | - this.message = message; |
| 25 | +class DNLMarkerError extends BaseException { |
| 26 | + constructor(message, scanLines) { |
| 27 | + super(message); |
34 | 28 | this.scanLines = scanLines; |
35 | 29 | } |
| 30 | +} |
36 | 31 |
|
37 | | - DNLMarkerError.prototype = new Error(); |
38 | | - DNLMarkerError.prototype.name = 'DNLMarkerError'; |
39 | | - DNLMarkerError.constructor = DNLMarkerError; |
40 | | - |
41 | | - return DNLMarkerError; |
42 | | -})(); |
43 | | - |
44 | | -let EOIMarkerError = (function EOIMarkerErrorClosure() { |
45 | | - function EOIMarkerError(message) { |
46 | | - this.message = message; |
47 | | - } |
48 | | - |
49 | | - EOIMarkerError.prototype = new Error(); |
50 | | - EOIMarkerError.prototype.name = 'EOIMarkerError'; |
51 | | - EOIMarkerError.constructor = EOIMarkerError; |
52 | | - |
53 | | - return EOIMarkerError; |
54 | | -})(); |
| 32 | +class EOIMarkerError extends BaseException { } |
55 | 33 |
|
56 | 34 | /** |
57 | 35 | * This code was forked from https://github.com/notmasteryet/jpgjs. |
|
0 commit comments