fix: improve regex error handling in CreateFunnelPage by providing specific step names in error messages

This commit is contained in:
Usman Baig
2026-02-04 23:54:44 +01:00
parent 002fe50d9a
commit 0c09c5b97e

View File

@@ -57,8 +57,9 @@ export default function CreateFunnelPage() {
toast.error('Please enter a path for all steps')
return
}
if (steps.some(s => s.type === 'regex' && !isValidRegex(s.value))) {
toast.error('Invalid regex in one or more steps. Check the pattern for steps with type "regex".')
const invalidRegexStep = steps.find(s => s.type === 'regex' && !isValidRegex(s.value))
if (invalidRegexStep) {
toast.error(`Invalid regex pattern in step: ${invalidRegexStep.name}`)
return
}