Improve error handling
Thank you for creating this library. There is a feature that I am struggling with. The library uses anyhow for error handling, this makes it hard to programmatically handle errors as I have to downcast errors to the actual errors. An example is init_file(). There are a few issues with this:
- I have to know what I can downcast to. The only way to find out is to dig around and experiment.
- The approach is counter to how I understand the intent of Rust. Rust is supposed to be explicit.
- I believe it is counter to how anyhow is intended to be used. My understanding is that anyhow is intended for top-level error handling at the application level, not error handling at a library level.
I struggle with error handling at other levels as well. How do I programmatically detect that logging has failed? Nothing is returned from error!(), warn!(), info!() macros.
I am not sure if this is a feature request, a bug, or just me misunderstanding how to use Rust and log4rs.
Thanks in advance!
I think you're right and we should probably be using thiserror in most of these places. I would need to take a deeper look. But it could also solve some of the issues we were talking about in #367.
@CaliViking you are correct. Its on our list for 2.0.