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

+1
View File
@@ -3100,6 +3100,7 @@
"title": "Export",
"description": "Lade deine Gesundheitsdaten als PDF, CSV oder vollständiges JSON-Backup herunter.",
"otherOptionsHeading": "Weitere Export-Optionen",
"downloadFailed": "Der Export konnte nicht heruntergeladen werden. Bitte versuche es erneut.",
"hero": {
"eyebrow": "Arzttermin",
"valueStatement": "Ein druckbarer PDF-Bericht für den Arzttermin — Vitalwerte, BMI, Blutdruck-Klassifikation, Medikamenten-Compliance und (optional) Stimmungsverlauf, alles auf wenigen Seiten.",
+1
View File
@@ -3100,6 +3100,7 @@
"title": "Export",
"description": "Download your health data as PDF, CSV, or a full JSON backup.",
"otherOptionsHeading": "Other export options",
"downloadFailed": "Couldn't download the export. Please try again.",
"hero": {
"eyebrow": "Doctor visit",
"valueStatement": "A printable PDF report for your doctor's appointment — vitals, BMI, blood-pressure classification, medication compliance and (optionally) mood, all on a few pages.",
+1
View File
@@ -3100,6 +3100,7 @@
"title": "Exportar",
"description": "Descarga tus datos de salud como PDF, CSV o una copia de seguridad JSON completa.",
"otherOptionsHeading": "Otras opciones de exportación",
"downloadFailed": "No se pudo descargar la exportación. Inténtalo de nuevo.",
"hero": {
"eyebrow": "Cita médica",
"valueStatement": "Un informe PDF imprimible para tu cita médica — constantes, IMC, clasificación de la tensión, cumplimiento de la medicación y (opcionalmente) el estado de ánimo, en pocas páginas.",
+1
View File
@@ -3100,6 +3100,7 @@
"title": "Exporter",
"description": "Téléchargez vos données de santé en PDF, CSV ou sauvegarde JSON complète.",
"otherOptionsHeading": "Autres options d'export",
"downloadFailed": "Échec du téléchargement de l'export. Veuillez réessayer.",
"hero": {
"eyebrow": "Rendez-vous médical",
"valueStatement": "Un rapport PDF imprimable pour votre rendez-vous médical — constantes, IMC, classification de tension, observance des traitements et (en option) historique de l'humeur, en quelques pages.",
+1
View File
@@ -3100,6 +3100,7 @@
"title": "Esporta",
"description": "Scarica i tuoi dati sanitari come PDF, CSV o backup JSON completo.",
"otherOptionsHeading": "Altre opzioni di esportazione",
"downloadFailed": "Impossibile scaricare l'esportazione. Riprova.",
"hero": {
"eyebrow": "Visita medica",
"valueStatement": "Un referto PDF stampabile per la visita medica — parametri vitali, BMI, classificazione della pressione, aderenza alla terapia e (facoltativamente) l'andamento dell'umore, in poche pagine.",
+1
View File
@@ -3100,6 +3100,7 @@
"title": "Eksportuj",
"description": "Pobierz swoje dane zdrowotne jako PDF, CSV lub pełną kopię zapasową JSON.",
"otherOptionsHeading": "Inne opcje eksportu",
"downloadFailed": "Nie udało się pobrać eksportu. Spróbuj ponownie.",
"hero": {
"eyebrow": "Wizyta u lekarza",
"valueStatement": "Raport PDF do druku na wizytę u lekarza — parametry życiowe, BMI, klasyfikacja ciśnienia, przestrzeganie leczenia oraz (opcjonalnie) zapis nastroju, na kilku stronach.",
+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);
}