Skip to content

Commit

Permalink
refactor(index): consolidate error codes (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Sep 20, 2023
1 parent 0e048a4 commit f899904
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const errorMessages = {
4: "Error related to ICC profile",
99: "Other error",
3221226505: "Internal process error",
unk: "Unknown error",
};

/**
Expand Down Expand Up @@ -362,9 +363,7 @@ class Poppler {
} else {
reject(
new Error(
code
? errorMessages[code]
: 'No error code returned from "pdfimages"'
code ? errorMessages[code] : errorMessages.unk
)
);
}
Expand Down Expand Up @@ -779,9 +778,7 @@ class Poppler {
} else {
reject(
new Error(
code
? errorMessages[code]
: 'No error code returned from "pdftocairo"'
code ? errorMessages[code] : errorMessages.unk
)
);
}
Expand Down Expand Up @@ -1113,9 +1110,7 @@ class Poppler {
} else {
reject(
new Error(
code
? errorMessages[code]
: 'No error code returned from "pdftoppm"'
code ? errorMessages[code] : errorMessages.unk
)
);
}
Expand Down Expand Up @@ -1361,9 +1356,7 @@ class Poppler {
} else {
reject(
new Error(
code
? errorMessages[code]
: 'No error code returned from "pdftops"'
code ? errorMessages[code] : errorMessages.unk
)
);
}
Expand Down Expand Up @@ -1517,9 +1510,7 @@ class Poppler {
} else {
reject(
new Error(
code
? errorMessages[code]
: 'No error code returned from "pdftotext"'
code ? errorMessages[code] : errorMessages.unk
)
);
}
Expand Down

0 comments on commit f899904

Please sign in to comment.