Missing Header Raises Roo::HeaderRowNotFoundError
#247
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.
Currently, Roo raises a generic
RuntimeError
with the message"Couldn't find header row" when a matching header row is not found.
This behavior makes it difficult to rescue from the most specific error
desired, because
RuntimeError
is the default error class forraise
.Additionally, because Roo does not have its own library-level error
class from which all errors inherit, it is difficult to differentiate
Roo library errors from errors caused by the developer / user.
From the Ruby documentation:
This commit adds a generic
Roo::Error
class which inherits fromStandardError
and a specificRoo::HeaderRowNotFound
class that israised when a matching header row could not be found.
In the future, additional subclasses of
Roo::Error
can be added inorder to allow users to more easily rescue the correct errors.
Note: This is not a backwards-compatible change. Users who currently
rescue
RuntimeError
for a missing header row will now see an errorraised.