fix(parser)!: throw ParsingException for a value that does not convert - #162
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-2x
branch
from
October 1, 2026 21:22
0ed0517 to
fa2dac4
Compare
A value that does not convert to the property type (for example `Age == "abc"`, `Rating > abc`, or an int overflow) threw FormatException or OverflowException. It now throws ParsingException, with the original exception as the inner exception. BREAKING CHANGE: a bad filter value throws ParsingException, not FormatException or OverflowException. Catch ParsingException or QueryKitException instead. The inner exception keeps the original details.
…hat does not convert An enum list value such as BirthMonth ^^ ["Bogus"] leaked a raw ArgumentException from Enum.Parse. Every conversion site now throws ParsingException. The message names the value, the target type, and the query name that the client wrote. The culture number fallback keeps this message instead of the generic one.
pdevito3
force-pushed
the
fm/qk-breaking-2x
branch
from
October 3, 2026 12:13
fa2dac4 to
0dde243
Compare
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.
Summary
A filter value that does not convert to the type of its property now always throws
ParsingException. Before this change, some bad values escaped theQueryKitExceptionhierarchy. A consumer that catches onlyQueryKitExceptionreturned a500for them.ParseFiltercatchesFormatExceptionandOverflowExceptionand throwsParsingException.An enum list value such as
BirthMonth ^^ ["Bogus"]orBirthMonth ^^ [Bogus]leaked a rawArgumentExceptionfromEnum.Parse. It now throwsParsingException.Every conversion site (scalar, list, enum,
Guid,DateTime,DateTimeOffset,DateOnly,TimeOnly) uses one path.The message names the value, the target type, and the property name as the client wrote it (the query name, not the member path):
The value 'Bogus' is not a valid BirthMonthEnum for the filter property 'BirthMonth'.The culture number fallback (for example
Rating > 4.4inde-DE) keeps this message. Before, it replaced the message with the generic parsing message.The original exception stays on
InnerException.Migration
FormatException,OverflowException, orArgumentExceptionfromApplyQueryKitFilter, catchParsingException(orQueryKitException) instead.Evidence
The verify-querykit harness ran on the memory and Postgres targets. The model has
Visibility(enum) andRating(int).Visibility ^^ ["Bogus"]System.ArgumentException"Requested value 'Bogus' was not found." (exit 1)ParsingException"The value 'Bogus' is not a valid Visibility for the filter property 'Visibility'." (exit 2)Visibility ^^ [Bogus]System.ArgumentException(exit 1)ParsingException, same message (exit 2)Visibility ^^ [Public, Bogus]System.ArgumentException(exit 1)ParsingException, same message (exit 2)Visibility == "Bogus"ParsingExceptionwith the generic messageParsingExceptionthat names the valueRating == "abc"ParsingExceptionwith the generic messageVisibility ^^ ["Private"]Tests:
Int32,Decimal,Guid,DateTime,Boolean, and list values. One test covers a query name alias (month). One test covers the comma culture fallback.dotnet build -warnaserror: 0 warnings.Rating > "abc"andTitle @= nullas escapes fromQueryKitException.Merge Danger