Skip to content

Commit

Permalink
Broader catch
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Feb 28, 2024
1 parent 0a91a0b commit 7f2c69e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/NiivueMutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ class NiivueMutator {
try {
setter(value);
} catch (e) {
if (!(e instanceof Error)) {
if (!(e instanceof TypeError)) {
throw e;
}
if (
e.message === "this.crosshairs3D is null" ||
e.message === "Cannot read properties of null (reading 'mm')"
) {
// check for messages like:
// this.crosshairs3D is null
// Cannot read properties of null (reading 'mm')
// null is not an object (evaluating 'this.crosshairs3D.mm')
if (e.message.includes("null") && (e.message.includes("mm") || e.message.includes("crosshairs3D"))) {
console.warn(
"Caught error which was fixed in https://github.com/niivue/niivue/pull/864, please update Niivue.",
);
Expand Down

0 comments on commit 7f2c69e

Please sign in to comment.