rustbus icon indicating copy to clipboard operation
rustbus copied to clipboard

`rustbus::client_conn::Error` doesn't implement `std::error::Error`

Open htejun opened this issue 5 years ago • 2 comments

This prevents generalized error handling. e.g. w/ anyhow:

fn connect_sys() -> anyhow::Result<rustbus::Conn> {                                                                                                                                                                  
    let sys_path = get_system_bus_path()?;                                                                                                                                                                           
    rustbus::Conn::connect_to_bus(sys_path, true)                                                                                                                                                                    
}                                                                                                                                                                                                                    
                                                                                                                                                                                                                     
fn main() {                                                                                                                                                                                                          
    let _ = match connect_sys() {                                                                                                                                                                                    
        Ok(_) => {},                                                                                                                                                                                                 
        Err(e) => println!("error={}", &e),                                                                                                                                                                          
    }                                                                                                                                                                                                                
}                                                                                                                                                                                                                    

htejun avatar Nov 22 '20 15:11 htejun

Hey,

This is an issue I intend to work on in the future. I was going to look into the available crates that make error handling more ergonomic. The current *Error enums have grown as I was writing the library. Currently there is a relatively big part being written in dispatch_conn branch, which I am focussing on at the moment. Making errors better is definitely on the roadmap though.

KillingSpark avatar Nov 23 '20 08:11 KillingSpark

Understood. For now, I'm working around by manually formatting rustbus error into an anyhow error. I'll update once rustbus gets updated. Thank you so much.

htejun avatar Nov 23 '20 12:11 htejun

I don't know why I did not update this issue, but I got around to doing this quite a while ago in commit 58144f68bc05fe881eeda20cdb9e6cb9ef0bd1f0 so...

Maybe hold off from updating quite yet, I'll make a new release with the commits from today

KillingSpark avatar Nov 12 '22 19:11 KillingSpark