+Josefin Odermalm <112946011+josod827@users.noreply.github.com>
-********************
+---
The text of the 3 clause BSD license follows:
@@ -258,15 +259,15 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
+ list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
-may be used to endorse or promote products derived from this software without
-specific prior written permission.
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
diff --git a/ts/lib/components/ErrorPage.svelte b/ts/lib/components/ErrorPage.svelte
index 01bcb1224..ebfc1aef8 100644
--- a/ts/lib/components/ErrorPage.svelte
+++ b/ts/lib/components/ErrorPage.svelte
@@ -2,12 +2,32 @@
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
+
+
- {error.message}
+ {normalizeErrorMessage(error.message)}
+
+
+
+
diff --git a/ts/routes/import-csv/[...path]/+page.svelte b/ts/routes/import-csv/[...path]/+page.svelte
index 4553c1bfe..0a6a6d27f 100644
--- a/ts/routes/import-csv/[...path]/+page.svelte
+++ b/ts/routes/import-csv/[...path]/+page.svelte
@@ -4,9 +4,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
-
+{#if data.initialError}
+
+{:else}
+
+{/if}
diff --git a/ts/routes/import-csv/[...path]/+page.ts b/ts/routes/import-csv/[...path]/+page.ts
index cda2bace9..bd7d80407 100644
--- a/ts/routes/import-csv/[...path]/+page.ts
+++ b/ts/routes/import-csv/[...path]/+page.ts
@@ -6,14 +6,20 @@ import { ImportCsvState } from "../lib";
import type { PageLoad } from "./$types";
export const load = (async ({ params }) => {
- const [notetypes, decks, metadata] = await Promise.all([
- getNotetypeNames({}),
- getDeckNames({
- skipEmptyDefault: false,
- includeFiltered: false,
- }),
- getCsvMetadata({ path: params.path }, { alertOnError: false }),
- ]);
- const state = new ImportCsvState(params.path, notetypes, decks, metadata);
- return { state };
+ try {
+ const [notetypes, decks, metadata] = await Promise.all([
+ getNotetypeNames({}),
+ getDeckNames({
+ skipEmptyDefault: false,
+ includeFiltered: false,
+ }),
+ getCsvMetadata({ path: params.path }, { alertOnError: false }),
+ ]);
+
+ const state = new ImportCsvState(params.path, notetypes, decks, metadata);
+ return { state };
+ } catch (e: any) {
+ const rawMsg = e?.message ?? String(e ?? "");
+ return { initialError: new Error(rawMsg) };
+ }
}) satisfies PageLoad;