reader: Dont return option for file #44
Merged
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.
@Daniil-Golikov here is some extra feedback for #41 I figured it would be easiest to just demonstrate what I mean with a PR.
In general, we should never silently do nothing when we are expected to do something.
If we cannot carry out a task then we need to report to the user in some way that the task failed.
This is useful for both:
In this case we have the partially implemented functionality around reading raw files.
Instead of returning a None, we should make some kind of error occur:
todo!()
since that will direct developers directly to the line that needs further work via the stacktrace.error!
log instead. We already return a Result so we could just return a Result::Err instead of a Option::None.Avoiding the option is also beneficial because we dont want the
read_file
API to be affected by the in progress nature of its current implementation. Since once its completed it wouldnt need the Option at all.