rawloader
rawloader copied to clipboard
Implement std::error::Error for errors
Currently the error type is Err(String)
for most (maybe all) operations. This means you can't use this library with something like anyhow.
I've heard good things about thiserror. Maybe that's an alternative?
There's already an error type that uses std::error::Error
:
https://github.com/pedrocr/rawloader/blob/9c13d5162cc0c6d1740a9fbe5c5a8d5983f05d2b/src/lib.rs#L73-L98
What else would be needed?
I didn't realise there was such a struct already in place. It should be enough for anyhow. It just requires std::error::Error + Send + Sync + 'static
.
I can try to update all places that still use a String
and make them use RawLoaderError
instead then?
Go ahead if you want. The reason I didn't bother was that those are all internal to the crate and so don't affect the API.