mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Don't duplicate the Jbig2Error exception
Let `src/core/jbig2_ccittFax_wasm.js` import the existing exception, rather than duplicate its code.
This commit is contained in:
parent
29362e6afb
commit
efa13c5e2a
@ -13,15 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseException, warn } from "../shared/util.js";
|
||||
import { fetchBinaryData } from "./core_utils.js";
|
||||
import JBig2 from "../../external/jbig2/jbig2.js";
|
||||
|
||||
class JBig2Error extends BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "Jbig2Error");
|
||||
}
|
||||
}
|
||||
import { Jbig2Error } from "./jbig2.js";
|
||||
import { warn } from "../shared/util.js";
|
||||
|
||||
class JBig2CCITTFaxWasmImage {
|
||||
static #buffer = null;
|
||||
@ -87,7 +82,7 @@ class JBig2CCITTFaxWasmImage {
|
||||
}
|
||||
const module = await this.#modulePromise;
|
||||
if (!module) {
|
||||
throw new JBig2Error("JBig2 failed to initialize");
|
||||
throw new Jbig2Error("JBig2 failed to initialize");
|
||||
}
|
||||
let ptr, globalsPtr;
|
||||
|
||||
@ -118,7 +113,7 @@ class JBig2CCITTFaxWasmImage {
|
||||
module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize);
|
||||
}
|
||||
if (!module.imageData) {
|
||||
throw new JBig2Error("Unknown error");
|
||||
throw new Jbig2Error("Unknown error");
|
||||
}
|
||||
const { imageData } = module;
|
||||
module.imageData = null;
|
||||
@ -139,4 +134,4 @@ class JBig2CCITTFaxWasmImage {
|
||||
}
|
||||
}
|
||||
|
||||
export { JBig2CCITTFaxWasmImage, JBig2Error };
|
||||
export { JBig2CCITTFaxWasmImage };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user