From d952fab4cd4699cd4dc6cab4873be1d9a2e796d2 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 25 Apr 2026 20:51:00 +0200 Subject: [PATCH] feat(persons): add INVALID_PERSON_TYPE error code with i18n translations Co-Authored-By: Claude Sonnet 4.6 --- .../java/org/raddatz/familienarchiv/exception/ErrorCode.java | 2 ++ frontend/messages/de.json | 1 + frontend/messages/en.json | 1 + frontend/messages/es.json | 1 + frontend/src/lib/errors.ts | 3 +++ 5 files changed, 8 insertions(+) diff --git a/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java b/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java index 187b793d..0db1d92d 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/exception/ErrorCode.java @@ -13,6 +13,8 @@ public enum ErrorCode { PERSON_NOT_FOUND, /** A person name alias with the given ID does not exist. 404 */ ALIAS_NOT_FOUND, + /** The submitted personType value is not allowed (e.g. SKIP is import-only). 400 */ + INVALID_PERSON_TYPE, // --- Documents --- /** A document with the given ID does not exist. 404 */ diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 0384e776..fa2bf5ab 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -536,6 +536,7 @@ "person_alias_delete_body": "Dieser Name wird aus der Suche entfernt.", "person_alias_btn_delete": "Entfernen", "error_alias_not_found": "Der Namensalias wurde nicht gefunden.", + "error_invalid_person_type": "Der angegebene Personentyp ist ungültig.", "error_ocr_service_unavailable": "Der OCR-Dienst ist nicht verfügbar.", "error_ocr_job_not_found": "Der OCR-Auftrag wurde nicht gefunden.", "error_ocr_document_not_uploaded": "Das Dokument hat keine Datei — OCR ist nicht möglich.", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 5e75ef71..dd775f26 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -536,6 +536,7 @@ "person_alias_delete_body": "This name will be removed from search results.", "person_alias_btn_delete": "Remove", "error_alias_not_found": "The name alias was not found.", + "error_invalid_person_type": "The specified person type is not valid.", "error_ocr_service_unavailable": "The OCR service is not available.", "error_ocr_job_not_found": "The OCR job was not found.", "error_ocr_document_not_uploaded": "The document has no file — OCR is not possible.", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 12c2c5c9..79b8aedd 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -536,6 +536,7 @@ "person_alias_delete_body": "Este nombre se eliminara de los resultados de busqueda.", "person_alias_btn_delete": "Eliminar", "error_alias_not_found": "No se encontro el alias de nombre.", + "error_invalid_person_type": "El tipo de persona especificado no es válido.", "error_ocr_service_unavailable": "El servicio OCR no está disponible.", "error_ocr_job_not_found": "No se encontró el trabajo OCR.", "error_ocr_document_not_uploaded": "El documento no tiene archivo — OCR no es posible.", diff --git a/frontend/src/lib/errors.ts b/frontend/src/lib/errors.ts index eec7a3e1..6acdefbe 100644 --- a/frontend/src/lib/errors.ts +++ b/frontend/src/lib/errors.ts @@ -7,6 +7,7 @@ import * as m from '$lib/paraglide/messages.js'; export type ErrorCode = | 'PERSON_NOT_FOUND' | 'ALIAS_NOT_FOUND' + | 'INVALID_PERSON_TYPE' | 'DOCUMENT_NOT_FOUND' | 'DOCUMENT_NO_FILE' | 'FILE_NOT_FOUND' @@ -73,6 +74,8 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string { return m.error_person_not_found(); case 'ALIAS_NOT_FOUND': return m.error_alias_not_found(); + case 'INVALID_PERSON_TYPE': + return m.error_invalid_person_type(); case 'DOCUMENT_NOT_FOUND': return m.error_document_not_found(); case 'DOCUMENT_NO_FILE':