Add error guards to catch blocks
This commit is contained in:
parent
3a0a9b231d
commit
c1cde5b94f
@ -108,7 +108,9 @@ function DiceInteraction({
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
setError(error);
|
||||
if (error instanceof Error) {
|
||||
setError(error);
|
||||
}
|
||||
}
|
||||
}, [onSceneMount]);
|
||||
|
||||
|
@ -562,7 +562,9 @@ export async function getGridSizeFromImage(image: HTMLImageElement) {
|
||||
try {
|
||||
prediction = await gridSizeML(image, candidates);
|
||||
} catch (error) {
|
||||
logError(error);
|
||||
if (error instanceof Error) {
|
||||
logError(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!prediction) {
|
||||
|
@ -67,10 +67,12 @@ function useImageDrop(
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.message === "Failed to fetch") {
|
||||
addToast("Unable to import image: failed to fetch");
|
||||
} else {
|
||||
addToast("Unable to import image");
|
||||
if (e instanceof Error) {
|
||||
if (e.message === "Failed to fetch") {
|
||||
addToast("Unable to import image: failed to fetch");
|
||||
} else {
|
||||
addToast("Unable to import image");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user