[Quality Management] Fix missing validation of "Allowable Values" on Quality Test card#8287
Open
JakovljevicDusan wants to merge 3 commits into
Open
[Quality Management] Fix missing validation of "Allowable Values" on Quality Test card#8287JakovljevicDusan wants to merge 3 commits into
JakovljevicDusan wants to merge 3 commits into
Conversation
| end; | ||
|
|
||
| [TryFunction] | ||
| local procedure TryApplyBooleanFilter(FilterExpression: Text) |
Contributor
There was a problem hiding this comment.
Error() called inside [TryFunction] with empty placeholders
TryApplyBooleanFilter is marked [TryFunction] but raises Error() explicitly with empty-string placeholders ('' for field name and literal 'Boolean' for type). While AL [TryFunction] does catch explicit Error() calls and returns false, the inner error message is set with missing context, and the outer ValidateAllowableValuesFormat then raises its own error — meaning two error messages are generated internally before the user-visible one, which can confuse debugging and telemetry.
Recommendation:
- Remove the explicit
Error()from insideTryApplyBooleanFilterand instead return without error from the try function; let the caller (ValidateAllowableValuesFormat) raise the user-visible error with full context. Alternatively, validate boolean values in a regular (non-try) procedure.
Suggested change
| local procedure TryApplyBooleanFilter(FilterExpression: Text) | |
| [TryFunction] | |
| local procedure TryApplyBooleanFilter(FilterExpression: Text) | |
| var | |
| QltyBooleanParsing: Codeunit "Qlty. Boolean Parsing"; | |
| begin | |
| if not QltyBooleanParsing.CanTextBeInterpretedAsBooleanIsh(FilterExpression) then | |
| Error(''); | |
| end; |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Linked work
Fixes AB#624240