From db76fb3d49095192d4d7bd5f7572c2a8111fe718 Mon Sep 17 00:00:00 2001 From: Rafal Dziegielewski Date: Tue, 27 Aug 2024 13:59:47 +0200 Subject: [PATCH] fix: fix ForbiddenError returning information about record --- .../services/action-error-handler/action-error-handler.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/services/action-error-handler/action-error-handler.ts b/src/backend/services/action-error-handler/action-error-handler.ts index dfaf1bb9a..62ca70c2b 100644 --- a/src/backend/services/action-error-handler/action-error-handler.ts +++ b/src/backend/services/action-error-handler/action-error-handler.ts @@ -51,6 +51,12 @@ const actionErrorHandler = ( const recordJson = record?.toJSON?.(currentAdmin) + if (error instanceof ForbiddenError && recordJson) { + recordJson.params = {} + recordJson.title = '' + recordJson.populated = {} + } + notice = { message: baseMessage, type: 'error',