You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both Query and QuerySingle methods now throw a JsonException when Options.ErrorWhenNotMatched is enabled and the JSONPath filter matches no results, instead of silently returning empty/null. Changes include new unit tests, changelog entries, and version bumps (1.1.0→1.2.0, 1.2.0→1.3.0) for the respective packages.
Changes
JSON.Query and JSON.QuerySingle exception handling
Layer / File(s)
Summary
Query throws on empty match Frends.JSON.Query/Frends.JSON.Query/Query.cs
Query materializes SelectTokens results into a List and throws JsonException when the list is empty and ErrorWhenNotMatched is true.
Query tests and release notes Frends.JSON.Query/Frends.JSON.Query.UnitTests/UnitTests.cs, Frends.JSON.Query/CHANGELOG.md, Frends.JSON.Query/Frends.JSON.Query/Frends.JSON.Query.csproj
New test asserts JsonException is thrown; changelog documents the fix; package version bumped to 1.2.0.
QuerySingle throws on null match Frends.JSON.QuerySingle/Frends.JSON.QuerySingle/QuerySingle.cs
QuerySingle stores SelectToken result in a variable, checks for null, and throws JsonException when ErrorWhenNotMatched is true.
QuerySingle tests and release notes Frends.JSON.QuerySingle/Frends.JSON.QuerySingle.UnitTests/UnitTests.cs, Frends.JSON.QuerySingle/CHANGELOG.md, Frends.JSON.QuerySingle/Frends.JSON.QuerySingle/Frends.JSON.QuerySingle.csproj
New test asserts JsonException is thrown; changelog documents the fix; package version bumped to 1.3.0.
A rabbit hops through JSON trees so deep,
When no match found, no silence to keep,
A JsonException now hops out with glee,
Two packages bumped, versions set free,
🐇 Fixed and tested, tidy as can be!
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
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.
Dear PR creator, please select one of the PR templates, then remove others and this text.
Default PR template
Please review my changes :)
Task Update PR template
Review Checklist
Summary by CodeRabbit
QueryandQuerySinglenow throw an exception when ErrorWhenNotMatched is enabled and no JSONPath results are found.