This repository was archived by the owner on May 21, 2026. It is now read-only.
fix: improve error mapping in readers/writers and benchmark#32
Merged
Conversation
Closes #25, #26, #27, #28.
Library:
- XtcError / TrrError gain AccessDenied, IsDir, NoSpaceLeft, IoError;
XtcError also gains InvalidHeader.
- mapOpenError() helper unifies open/create error mapping. Previously
every Reader.open failure collapsed into FileNotFound, every
Writer.open failure into WriteError -- both now distinguish the
important cases.
- Reader.open uses allow_directory=false so opening a directory
fails fast with IsDir at open time instead of later with
generic ReadError on the first read.
- TrrWriter.open append: replace mapping `readHeader catch ReadError`
with `try`, so InvalidMagic / InvalidHeader survive.
- XtcWriter.open append: distinguish truncated header
(InvalidHeader) from real ReadFailed (ReadError).
- XtcReader.open: non-positive natoms now reported as
InvalidAtomCount instead of ReadError.
Tests:
- New IsDir tests for both Readers and Writers (XTC + TRR).
Benchmark:
- loadReference: log non-FileNotFound errors and JSON parse
errors instead of silently returning null.
- benchmarkXtc / benchmarkTrr: log stat and open failures
with the failing path and error name; FileNotFound stays silent.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Closes #25, #26, #27, #28.
Replace silent / overly-coarse error catches with structured error mapping. Adds new error variants so callers can actually triage failures.
Library changes
Benchmark changes
Test plan
Compatibility
This is technically additive (new error variants), but exhaustive switches over `XtcError` / `TrrError` will need new arms. Minor bump recommended at next release.