Skip to content

feat: add Scanner.LastError() - #129

Merged
CorentinGS merged 2 commits into
CorentinGS:mainfrom
kewlar:add-last-error
Oct 25, 2026
Merged

CorentinGS merged 2 commits into
CorentinGS:mainfrom
kewlar:add-last-error

Conversation

@kewlar

@kewlar kewlar commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Scanner.HasNext() can encounter an error which it saves to Scanner.lastError, but there is no way for the user to see what the error was, because lastError is not exposed.

This PR adds method Scanner.HasNext() which returns the lastError.


Rationale: Encountered an error while trying to parse the PGN file for the longest possible chess game.

@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.14%. Comparing base (6771e79) to head (5c0fb2f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
+ Coverage   80.95%   81.14%   +0.18%     
==========================================
  Files          28       28              
  Lines        4468     4470       +2     
==========================================
+ Hits         3617     3627      +10     
+ Misses        720      716       -4     
+ Partials      131      127       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

lastError only ever holds the scanner's read error, set by HasNext when
the source could not be read; the previous wording ("while parsing the
game") overstated it. The example now nests with four spaces, like every
other example in this file.

Adds tests covering both a successful scan and a read failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CorentinGS
CorentinGS merged commit bca363e into CorentinGS:main Oct 25, 2026
8 checks passed
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