1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #17956 from calixteman/jpx_exceptions

[JPX] Throw an exception with the error messages returned by openjpeg
This commit is contained in:
Tim van der Meij 2024-04-16 20:48:23 +02:00 committed by GitHub
commit 7290faf840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -28,8 +28,8 @@ class JpxImage {
static decode(data, ignoreColorSpace = false) {
this.#module ||= OpenJPEG();
const imageData = this.#module.decode(data, ignoreColorSpace);
if (!imageData) {
throw new JpxError("JPX decode failed");
if (typeof imageData === "string") {
throw new JpxError(imageData);
}
return imageData;
}