Repository navigation
BUG: Set error messages in H5OIMReader and H5EspritReader - #70
Closed
imikejackson wants to merge 1 commit into
Closed
imikejackson wants to merge 1 commit into
imikejackson wants to merge 1 commit into
Conversation
…Software#69) Each error branch wrote its message into a std::stringstream built from an empty std::string and then passed that empty string to setErrorMessage(), so the reader's error message was always empty. Use ss.str() instead. The "could not read header" and "could not read data" branches now put the detailed message from readHeader()/readData() after their own message, so that detail is kept. Before, H5EspritReader did not set a message there, and H5OIMReader replaced the detail with an empty message. H5EspritReader::readFile() and readHeaderOnly() returned 0 (success) when the HDF5 file could not be opened. They now return the error code (-2). Adds regression tests for a missing file (both readers) and for a missing scan path (H5EspritReader). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imikejackson
force-pushed
the
issue69-reader-error-messages
branch
from
November 12, 2026 18:36
33c3718 to
85884f4
Compare
This was referenced Nov 13, 2026
Collaborator
Author
|
Closed in favor of #86, which merges this branch (with its history) together with the other open EbsdLib fixes for the next release, so simplnx can build against one EbsdLib branch. The branch is kept. 🤖 Generated with Claude Code |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #69.
Problem
H5OIMReaderandH5EspritReaderset an error code but leave the error message empty. In each of 23 error branches, the code writes the message into astd::stringstreambuilt from an emptystd::string, then passes that empty string tosetErrorMessage(). Programs that show the reader's message, such as the simplnx Read EDAX OIMAnalysis Data (.h5) and Read Bruker Nano Esprit Data (.h5) filters, show nothing.There is a second defect in the same functions. When
H5EspritReader::readHeaderOnly()orreadFile()cannot open the HDF5 file, they return0(success), because they returnerrfromsanityCheckForOpening().getErrorCode()is-2. The issue notes this defect, and a new unit test confirms it. It is fixed in this PR.Changes
setErrorMessage(ss.str())and no longer create the unusedstd::string.readHeader()/readData()after their own message, so that detail is kept. Before,H5EspritReaderdid not set a message in these branches, andH5OIMReaderreplaced the detail with an empty message.H5EspritReader::readFile()andreadHeaderOnly()returngetErrorCode()(-2) when the file cannot be opened.Tests
EdaxOIMReaderTest::HeaderErrorHasMessage: a missing file.readHeaderOnly()andreadFile()return a value below 0, and the message contains the file path.H5EspritReaderTest::MissingFileHasError: a missing file. Both functions return a value below 0, the error code is-2, and the message contains the file path.H5EspritReaderTest::MissingScanHasMessage: a valid file with a scan path that does not exist. The error code is-90020, and the message contains the scan path.All three tests fail before the fix: Esprit
readHeaderOnly()andreadFile()return0, and the messages are empty. All 431 tests pass after the fix (macOS arm64, Release).🤖 Generated with Claude Code