Skip to content

fix(operators)!: throw QueryKitParsingException for an unknown logical operator - #164

Merged
pdevito3 merged 1 commit into
v2from
fm/qk-breaking-logical-operator
Oct 2, 2026
Merged

pdevito3 merged 1 commit into
v2from
fm/qk-breaking-logical-operator

Conversation

@pdevito3

@pdevito3 pdevito3 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

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.

What breaks

The public method LogicalOperator.GetByOperatorString throws QueryKitParsingException for an operator that it does not know. On v1.14.2 and main, it throws System.Exception. The message does not change.

The filter parser calls this method only with && or ||, which the grammar reads first. As a result, a filter does not get to this throw. Only code that calls LogicalOperator.GetByOperatorString directly sees the new type.

Example

Call v1.14.2 and main This PR
LogicalOperator.GetByOperatorString("xor") Exception: Operator xor is not supported QueryKitParsingException: Operator xor is not supported

Justification

The README says that QueryKitException is the base class of all QueryKit exceptions. A plain System.Exception from a public QueryKit method escapes a catch (QueryKitException). QueryKitParsingException derives from QueryKitException.

Migration

If your code calls LogicalOperator.GetByOperatorString and catches Exception by its exact type, catch QueryKitParsingException or QueryKitException.

Tests

  • New unit test: unknown_logical_operator_throws_query_kit_parsing_exception.
  • dotnet test on this branch: 471 unit tests and 297 Postgres integration tests (Testcontainers) pass, 0 failures.

…l operator

LogicalOperator.GetByOperatorString threw System.Exception for an operator that it does not know. It now throws QueryKitParsingException with the same message. QueryKitParsingException derives from QueryKitException.

BREAKING CHANGE: an unknown logical operator throws QueryKitParsingException, not System.Exception. Catch QueryKitParsingException or QueryKitException instead.
@pdevito3
pdevito3 force-pushed the fm/qk-breaking-logical-operator branch from 7c93f30 to fc60eb7 Compare October 2, 2026 19:44
@pdevito3
pdevito3 changed the base branch from main to v2 October 2, 2026 19:44
@pdevito3
pdevito3 merged commit e743495 into v2 Oct 2, 2026
2 checks passed
@pdevito3
pdevito3 deleted the fm/qk-breaking-logical-operator branch October 2, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant