Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/components/import-export.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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 }
);
}
</script>

<menu class="import-export">
Expand Down