Fix #6: Add eager/non-throwing validation for expression syntax errors#136
Conversation
…x errors - Add ExpressionValidator to validate expressions before compilation - Validate regex patterns in IsMatch()/IndexOfMatch() without throwing - Detect unknown function names gracefully - Validate CI modifier usage on functions that support it - Return validation errors via TryCompile() instead of throwing - Add test suite for validation scenarios
- Fix ${regex} to {regex} in log message (was outputting literal text)
- Rename CaseSensitiveFunctions to CaseInsensitiveCapableFunctions
- Add test for IndexOfMatch with invalid regex in Compile()
|
Howdy! Thanks for checking this out. Because I ran through the current expression compiler implementation; since compilation failures really are on the error path, I'm coming around to thinking we should just lean on a custom From the outside, i.e. to the tests, I think the behavior would be almost identical. I don't really like exceptions at the best of times :-) but skimming through the |
|
Thanks for the feedback! I understand the concerns about the pluggable NameResolver and parallel validation. A couple questions before I rework this:
Happy to rework this with the exception-based approach! |
|
Thanks for taking another look.
|
- Replace pre-validation with exception-based approach - Invalid regex and unknown functions now return friendly errors via TryCompile - CI modifier on non-supporting functions logs warnings instead of throwing (backward compatibility) - Use dynamic StringComparison parameter detection instead of hard-coded function lists
|
Thanks @nblumhardt! I've updated the PR with the exception-based approach:
All existing tests pass. Let me know if you need any adjustments. |
|
Awesome, thanks! Just looking for a chance to review, should be able to take a look shortly 😅 |
|
Thanks @willibrandon! |
Fixes #6
Implements eager validation for expression syntax errors, making them non-throwing in the TryCompile path.
Changes
Testing