From c7fd8328d6e8f0aee65b5fb7014efc0413a48228 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 4 Mar 2026 09:48:51 +0100 Subject: [PATCH] fix(errors) : humanize backend error messages for end users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add centralized error translation layer (humanizeError) that converts raw Symfony/Doctrine/API Platform messages into user-friendly French. Fix useApi to extract errors from all backend response formats (violations, error, message, hydra:description, detail). Add toast deduplication to prevent double display. Replace error toast icon (X → CircleX) to distinguish from the dismiss button. Co-Authored-By: Claude Opus 4.6 --- app/components/ToastContainer.vue | 3 +- app/components/model-types/ManagementView.vue | 25 ++- app/composables/useApi.ts | 14 +- app/composables/useEntityTypes.ts | 20 ++- app/composables/useMachineCreatePage.ts | 5 +- app/composables/useProducts.ts | 17 +- app/composables/useSiteManagement.ts | 5 +- app/composables/useToast.ts | 11 ++ app/pages/component/create.vue | 3 +- app/pages/index.vue | 5 +- app/pages/machine-skeleton/index.vue | 5 +- app/pages/machines/index.vue | 5 +- app/pages/pieces/create.vue | 3 +- app/pages/product/[id]/edit.vue | 3 +- app/shared/utils/errorMessages.ts | 152 ++++++++++++++++++ 15 files changed, 227 insertions(+), 49 deletions(-) create mode 100644 app/shared/utils/errorMessages.ts diff --git a/app/components/ToastContainer.vue b/app/components/ToastContainer.vue index c66635c..cfa6837 100644 --- a/app/components/ToastContainer.vue +++ b/app/components/ToastContainer.vue @@ -24,7 +24,7 @@ class="w-4 h-4" aria-hidden="true" /> -