fix(parser)!: throw QueryKitParsingException for a bad sort direction - #163
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-sort-direction
branch
from
October 1, 2026 21:23
afc35fa to
7d5925f
Compare
An invalid sort direction (for example `Age sideways`) threw ArgumentException. It now throws QueryKitParsingException with the same message. QueryKitParsingException derives from QueryKitException. BREAKING CHANGE: an invalid sort direction throws QueryKitParsingException, not ArgumentException. Catch QueryKitParsingException or QueryKitException instead.
pdevito3
force-pushed
the
fm/qk-breaking-sort-direction
branch
from
October 2, 2026 19:57
7d5925f to
2c98981
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.
For later consideration in a major version. Do not merge now. This PR is one of three PRs that replace #119. Each PR has one breaking change. The captain decides on each PR separately.
ParsingException.QueryKitParsingException.QueryKitParsingException.What breaks
An invalid sort direction throws
QueryKitParsingException. On v1.14.2 and main, it throwsArgumentException. The message does not change.Example
Age sidewaysArgumentException: Invalid direction: sideways. Allowed values are 'asc' and 'desc'.QueryKitParsingExceptionwith the same messageTitle, Age upArgumentException: Invalid direction: up. ...QueryKitParsingExceptionwith the same messageMain already accepts more than one space before a sort direction (
Age desc). This PR does not change that.Justification
The README says that
QueryKitExceptionis the base class of all QueryKit exceptions. On v1.14.2, a bad sort direction escapes acatch (QueryKitException). As a result, an API can return a 500 for a client error.QueryKitParsingExceptionderives fromQueryKitException.Migration
If your code catches
ArgumentExceptionfromApplyQueryKitSortorParseSort, catchQueryKitParsingExceptionorQueryKitException.Tests
invalid_sort_direction_throws_query_kit_parsing_exception(2 cases).dotnet teston this branch: 472 unit tests and 297 Postgres integration tests (Testcontainers) pass, 0 failures.