mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 06:32:03 +00:00
fix(errors): name three refusals that fell back to a generic sentence
Since a codeless refusal reads by its status, three answers lost their meaning. A failed ChatGPT sign-in poll said "Error saving" instead of asking to start the sign-in again; it now falls back to the sign-in's own failure sentence. A dose-history import still running when the card stopped watching said "Nothing was written" although the job may still write; that case now has its own sentence. Setting up an authenticator while one is active answered "setup failed"; the route now sends `auth.mfa.already_active`, which says to disable the active one first, in every locale.
This commit is contained in:
1 parent
31c4440154
commit
8c9fbbdd2b
17 files changed
+116
-11
No files matched your search
@@ -89,7 +89,7 @@ export function CodexProviderForm({
|
||||
intervalSeconds: data.intervalSeconds,
|
||||
});
|
||||
} catch (err) {
|
||||
setMsg(localizedApiError(err, t, "settings.savingError"));
|
||||
setMsg(localizedApiError(err, t, "settings.codexConnectionFailed"));
|
||||
setMsgType("error");
|
||||
setDevicePolling(false);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export function CodexProviderForm({
|
||||
if (!cancelled) setTimeout(tick, intervalMs);
|
||||
} catch (err) {
|
||||
if (cancelled) return;
|
||||
setMsg(localizedApiError(err, t, "settings.savingError"));
|
||||
setMsg(localizedApiError(err, t, "settings.codexConnectionFailed"));
|
||||
setMsgType("error");
|
||||
setDeviceCode(null);
|
||||
setDevicePolling(false);
|
||||
|
||||
@@ -31,7 +31,10 @@ import { Label } from "@/components/ui/label";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { apiFetchRaw } from "@/lib/api/api-fetch";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { waitForMedicationIntakeImport } from "@/lib/medications/intake-import-poll";
|
||||
import {
|
||||
MedicationIntakeImportTimeout,
|
||||
waitForMedicationIntakeImport,
|
||||
} from "@/lib/medications/intake-import-poll";
|
||||
import { invalidateMedicationReads } from "@/lib/query-keys";
|
||||
|
||||
import { DoseHistoryColumnRulings } from "./dose-history-columns";
|
||||
@@ -93,6 +96,17 @@ function looksLikeJson(text: string): boolean {
|
||||
return head === "[" || head === "{";
|
||||
}
|
||||
|
||||
/**
|
||||
* The sentence for an import that did not report a result. A failed run or
|
||||
* a transport failure wrote nothing; a job still running when the watch gave
|
||||
* up may still write, so it must not read as nothing written.
|
||||
*/
|
||||
function importFailureKey(err: unknown): string {
|
||||
return err instanceof MedicationIntakeImportTimeout
|
||||
? "settings.sections.export.import.doseHistory.stillRunning"
|
||||
: "settings.sections.export.import.doseHistory.failed";
|
||||
}
|
||||
|
||||
export function DoseHistoryImportCard() {
|
||||
const { t } = useTranslations();
|
||||
const fatalMessageFor = useFatalMessage();
|
||||
@@ -191,12 +205,11 @@ export function DoseHistoryImportCard() {
|
||||
skippedDetailsOmitted: result.skippedDetailsOmitted,
|
||||
});
|
||||
void invalidateMedicationReads(queryClient);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
// A failed job's reason is the worker's English and adds nothing;
|
||||
// anything else is a transport failure. Either way the run did not
|
||||
// write, and the card says so rather than leaving the last verdict on
|
||||
// screen.
|
||||
setError(t("settings.sections.export.import.doseHistory.failed"));
|
||||
// anything else is a transport failure. The card says what that means
|
||||
// rather than leaving the last verdict on screen.
|
||||
setError(t(importFailureKey(err)));
|
||||
setVerdict(null);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
|
||||
Reference in new issue
Block a user