release: v1.32.0 — hardening and scalability (#580)

* release: prepare v1.32.0

* test: stabilize water capture re-entry
This commit is contained in:
Marc-André Bombeck authored and GitHub committed 2026-07-22 04:14:15 +02:00
1 parent b01822be48
commit 62eb431d66
372 files changed
+25178 -8561

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { ApiError } from "./api-fetch";
type Translate = (key: string) => string;
/**
* Resolve an API envelope's stable error code through the locale catalog.
* Missing/unknown codes, network failures, and non-API errors deliberately
* collapse to the caller's safe domain fallback; server prose is never shown.
*/
export function localizedApiError(
error: unknown,
t: Translate,
fallbackKey: string,
): string {
if (error instanceof ApiError) {
const errorCode = error.meta?.errorCode;
if (typeof errorCode === "string") {
const key = `apiErrors.${errorCode}`;
const translated = t(key);
if (translated !== key) return translated;
}
}
return t(fallbackKey);
}