Abort early if the typeId or fieldId are not present.

This commit is contained in:
Skorpios committed 2025-03-16 13:28:32 -07:00
1 parent 8994b4b39b
commit 182c51387f
1 file changed
+8 -9
@@ -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