Skip to content

Fix Frends.JSON.QuerySingle compliance findings: net8, static class, CancellationToken, error handling - #43

Open
MichalFrends1 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-compliance-findings-frends-json-querysingle
Open

Fix Frends.JSON.QuerySingle compliance findings: net8, static class, CancellationToken, error handling#43
MichalFrends1 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-compliance-findings-frends-json-querysingle

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Resolves 5 task analyzer findings (FT0004, FT0007, FT0011, FT0015×2) plus framework and project metadata requirements for Frends.JSON.QuerySingle.

Changes

Frends.JSON.QuerySingle.csproj

  • Target framework: net6.0net8.0
  • Version bump: 1.3.01.4.0

QuerySingle.cs

  • JSON class made static (FT0004)
  • CancellationToken added as required parameter (FT0007)
  • Logic wrapped in try/catch delegating to ErrorHandler.Handle(options)

Definitions/Options.cs (FT0015)

  • Added ThrowErrorOnFailure (bool, default true)
  • Added ErrorMessageOnFailure (string, default "")

Definitions/Result.cs (FT0011)

  • Added Error property of new Error class (Message, AdditionalInfo)

Helpers/ErrorHandler.cs (new)

  • Standard Frends error handler: rethrows on cancellation, throws wrapped exception or returns failed Result based on ThrowErrorOnFailure

Frends.JSON.QuerySingle.UnitTests.csproj

  • Target framework: net6.0net8.0

Tests

  • Existing tests updated for new CancellationToken parameter and Exception (vs JsonException) throw type
  • New ErrorHandlerTests.cs covering throw-on-failure, return-failed-result, and custom error message paths
// New signature
var result = JSON.QuerySingle(input, new Options { ThrowErrorOnFailure = false }, CancellationToken.None);
// On error: result.Success == false, result.Error.Message contains details

// Or throw on failure (default)
var result = JSON.QuerySingle(input, new Options { ErrorMessageOnFailure = "My error" }, CancellationToken.None);
// Throws Exception("My error", innerEx) on failure

Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compliance findings in Frends.JSON.QuerySingle Fix Frends.JSON.QuerySingle compliance findings: net8, static class, CancellationToken, error handling Aug 5, 2026
Copilot AI requested a review from MichalFrends1 August 5, 2026 08:53
Co-authored-by: MichalFrends1 <167774394+MichalFrends1@users.noreply.github.com>
@MichalFrends1
MichalFrends1 marked this pull request as ready for review August 5, 2026 10:00
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.

2 participants