Add error guards to catch blocks
This commit is contained in:
parent
3a0a9b231d
commit
c1cde5b94f
@ -108,8 +108,10 @@ function DiceInteraction({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
setError(error);
|
setError(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [onSceneMount]);
|
}, [onSceneMount]);
|
||||||
|
|
||||||
const selectedMeshRef = useRef<AbstractMesh | null>(null);
|
const selectedMeshRef = useRef<AbstractMesh | null>(null);
|
||||||
|
@ -562,8 +562,10 @@ export async function getGridSizeFromImage(image: HTMLImageElement) {
|
|||||||
try {
|
try {
|
||||||
prediction = await gridSizeML(image, candidates);
|
prediction = await gridSizeML(image, candidates);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
logError(error);
|
logError(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!prediction) {
|
if (!prediction) {
|
||||||
prediction = gridSizeHeuristic(image, candidates);
|
prediction = gridSizeHeuristic(image, candidates);
|
||||||
|
@ -67,6 +67,7 @@ function useImageDrop(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
if (e.message === "Failed to fetch") {
|
if (e.message === "Failed to fetch") {
|
||||||
addToast("Unable to import image: failed to fetch");
|
addToast("Unable to import image: failed to fetch");
|
||||||
} else {
|
} else {
|
||||||
@ -74,6 +75,7 @@ function useImageDrop(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const files = event.dataTransfer?.files || [];
|
const files = event.dataTransfer?.files || [];
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
|
Loading…
Reference in New Issue
Block a user