diff --git a/src/components/import-export.svelte b/src/components/import-export.svelte index 5074c66..e5e6332 100644 --- a/src/components/import-export.svelte +++ b/src/components/import-export.svelte @@ -53,7 +53,13 @@ const localStorageContents = JSON.parse(fileContents); for (const [key, value] of Object.entries(localStorageContents)) { if (typeof key !== 'string' || typeof value !== 'string') { - throw new Error('Bad data'); + throwErr(); + } + + try { + JSON.parse(value); + } catch (err) { + throwErr(err as Error); } } @@ -65,6 +71,13 @@ location.reload(); } + + function throwErr(cause?: Error): never { + throw new Error( + 'Its not bad data the function is just dumb, its not your fault poor file, i love u ok, ur very cute, bye', + { cause: cause ?? undefined } + ); + }