From 182c51387f71d60d7518f5a4a53707854ea183fb Mon Sep 17 00:00:00 2001 From: Skorpios Date: Sun, 16 Mar 2025 13:28:32 -0700 Subject: [PATCH] Abort early if the typeId or fieldId are not present. --- .../Components/NotificationIntegrationModal.jsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx b/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx index dcd194048..0bcb8cf37 100644 --- a/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx +++ b/src/Components/NotificationIntegrationModal/Components/NotificationIntegrationModal.jsx @@ -49,16 +49,15 @@ const NotificationIntegrationModal = ({ // Helper to get the field state key with error handling const getFieldKey = (typeId, fieldId) => { - try { - if (typeof typeId !== 'string' || typeId === '' || - typeof fieldId !== 'string' || fieldId === '') { - return ''; - } - return `${typeId}${fieldId.charAt(0).toUpperCase() + fieldId.slice(1)}`; - } catch (error) { - console.error('Error generating field key:', error); - return ''; + if (typeof typeId !== 'string' || typeId === '') { + throw new Error('Invalid typeId provided to getFieldKey'); } + + if (typeof fieldId !== 'string' || fieldId === '') { + throw new Error('Invalid fieldId provided to getFieldKey'); + } + + return `${typeId}${fieldId.charAt(0).toUpperCase() + fieldId.slice(1)}`; }; // Define notification types