Skip to content

Commit efa13c5

Browse files
committed
Don't duplicate the Jbig2Error exception
Let `src/core/jbig2_ccittFax_wasm.js` import the existing exception, rather than duplicate its code.
1 parent 29362e6 commit efa13c5

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/core/jbig2_ccittFax_wasm.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { BaseException, warn } from "../shared/util.js";
1716
import { fetchBinaryData } from "./core_utils.js";
1817
import JBig2 from "../../external/jbig2/jbig2.js";
19-
20-
class JBig2Error extends BaseException {
21-
constructor(msg) {
22-
super(msg, "Jbig2Error");
23-
}
24-
}
18+
import { Jbig2Error } from "./jbig2.js";
19+
import { warn } from "../shared/util.js";
2520

2621
class JBig2CCITTFaxWasmImage {
2722
static #buffer = null;
@@ -87,7 +82,7 @@ class JBig2CCITTFaxWasmImage {
8782
}
8883
const module = await this.#modulePromise;
8984
if (!module) {
90-
throw new JBig2Error("JBig2 failed to initialize");
85+
throw new Jbig2Error("JBig2 failed to initialize");
9186
}
9287
let ptr, globalsPtr;
9388

@@ -118,7 +113,7 @@ class JBig2CCITTFaxWasmImage {
118113
module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize);
119114
}
120115
if (!module.imageData) {
121-
throw new JBig2Error("Unknown error");
116+
throw new Jbig2Error("Unknown error");
122117
}
123118
const { imageData } = module;
124119
module.imageData = null;
@@ -139,4 +134,4 @@ class JBig2CCITTFaxWasmImage {
139134
}
140135
}
141136

142-
export { JBig2CCITTFaxWasmImage, JBig2Error };
137+
export { JBig2CCITTFaxWasmImage };

0 commit comments

Comments
 (0)