Open Kl4rry opened 5 months ago
Indeed, I had to introduce this variant for the SQLite based history: https://github.com/kkawakam/rustyline/blob/4a7dfe90864638c2c8e68523bddc8949586323f0/src/error.rs#L33-L34
Another possible solution is to make History
generic over the error type and having a trait bound that it must implement into for ReadlineError
.
Just for reference:
As far as I know, other rust libraries doesn't support custom History
impl.
Termwiz kinda supports every error type as you can just to .ok()
on every error type.
There is a work around that can be used in both reedline and rustyline and that is to put the error in a IO error like this
std::io::Error::new(std::io::ErrorKind::InvalidData, Box::new(custom_error))
Currently the history trait requires the error return to be a readline error. That means that one cannot return other error types that are not included in:
This can be fixed by either adding a
Box<dyn std::error::Error>
variant that can be used to return anystd::error::Error
or by adding a optional generic error type like this: