fix(settings): show a friendly message when an export download fails

The export cards rendered the raw "Download failed (500)" error string to
the user. Map the failure to a localized message across all six locales.
This commit is contained in:
Marc-André Bombeck committed 2026-06-04 15:37:36 +02:00
1 parent eddc06d135
commit ad3bbd5507
7 files changed
+12 -6

No files matched your search

+6 -6
View File
@@ -259,8 +259,8 @@ function CsvCard({
const stamp = new Date().toISOString().slice(0, 10);
const filename = `${filenamePrefix}-${stamp}.csv`;
await downloadFromUrl(`${endpoint}${query}`, filename);
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
} catch {
setError(t("settings.sections.export.downloadFailed"));
} finally {
setBusy(false);
}
@@ -344,8 +344,8 @@ function MedicationsCsvCard() {
`/api/export/medications${query}`,
`healthlog-medications-${stamp}.csv`,
);
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
} catch {
setError(t("settings.sections.export.downloadFailed"));
} finally {
setBusy(false);
}
@@ -435,8 +435,8 @@ function FullBackupCard() {
"/api/export/full-backup",
`healthlog-backup-${stamp}.json`,
);
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
} catch {
setError(t("settings.sections.export.downloadFailed"));
} finally {
setBusy(false);
}