Using result type to reflect scanning error#28
Merged
delfanbaum merged 1 commit intodelfanbaum:mainfrom Sep 7, 2025
Merged
Conversation
Owner
|
Thanks for catching this! The CI is failing because of an issue with a feature dependency, so given that I'm about to fix that in the release I'm prepping, we can just merge this in and I'll do what little fiddling I'm going to do on the (rebased) release branch. Just FYI, one crate-idiomatic thing I'm going to change is to make the error less generic so that we can match on it if that's ever needed -- just to make it align more closely with the other error structs in the repo. The one code feedback thing I would note is that since that function is just a big match, you don't need the explicit return (since the other arms are returning, essentially _ => Err(ScannerError::String(format!("Invalid headling level: line {}", self.line)))In any case, thanks for the contribution! |
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.
This system already has a
ScannerErrorthat looks like it was built to be extended - I just added aScannerError::Stringdata constructor, and passed the call toerror!(...)intoScannerError::String(format!(...))to allow end-users the ability to decide how they want to handle the error. I also removed the process kill line.