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