mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
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:
1 parent
eddc06d135
commit
ad3bbd5507
7 files changed
+12
-6
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user