Skip to content

Commit

Permalink
[JPX] Throw an exception with the error messages returned by openjpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Apr 16, 2024
1 parent 801a097 commit ebcae30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion external/openjpeg/openjpeg.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/core/jpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class JpxImage {
static decode(data, ignoreColorSpace) {
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;
}
Expand Down

0 comments on commit ebcae30

Please sign in to comment.