Use empty history if search query fails #690
Closed
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.
There's a bunch of places with
.expect("todo: error handling")
, and this PR tries to remove most of them. Here's the four different kinds:examples/demo.rs
that I didn't bother with.Err
s as the history being empty.history.save(entry)
, inengine.rs
. This has been edited to silently ignore anErr
..expect
s are all insideengine.rs
and are for handling the result of moving thehistory_cursor
forward or backward. Unfortunately, all of them appear inside methods that return either()
or anio::Result
. These have also been edited to silently ignoreErr
s.A disadvantage of silently handling
Err
s is that users won't know that something went wrong, but if the.expect
s are to be kept, they should at least be changed to have more useful messages to help users file bug reports.There shouldn't be any user-facing changes from this.