diff --git a/src/components/dice/DiceInteraction.tsx b/src/components/dice/DiceInteraction.tsx index 88cf213..8494c24 100644 --- a/src/components/dice/DiceInteraction.tsx +++ b/src/components/dice/DiceInteraction.tsx @@ -108,7 +108,9 @@ function DiceInteraction({ } }); } catch (error) { - setError(error); + if (error instanceof Error) { + setError(error); + } } }, [onSceneMount]); diff --git a/src/helpers/grid.ts b/src/helpers/grid.ts index 2c5db2d..7e7a8e6 100644 --- a/src/helpers/grid.ts +++ b/src/helpers/grid.ts @@ -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) { diff --git a/src/hooks/useImageDrop.ts b/src/hooks/useImageDrop.ts index dde5616..749cdcc 100644 --- a/src/hooks/useImageDrop.ts +++ b/src/hooks/useImageDrop.ts @@ -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"); + } } } }