ferristseng / rust-ipfs-api

IPFS HTTP client in Rust
Apache License 2.0
247 stars 68 forks source link

standard Error traits? #81

Closed kallisti5 closed 2 years ago

kallisti5 commented 3 years ago

Any chance of implementing the standard error traits for ipfs_api?

    pub async fn heartbeat(&mut self) -> Result<(), Box<dyn Error>> {
        let client = IpfsClient::default();
        let nodeid = client.id(None).await?;
        println!("Connected to {}", nodeid.id);
        Ok(())
    }
error[E0277]: the trait bound `ipfs_api::response::Error: std::error::Error` is not satisfied
  --> src/ipfsbackend/mod.rs:33:43
   |
33 |         let nodeid = client.id(None).await?;
   |                                           ^ the trait `std::error::Error` is not implemented for `ipfs_api::response::Error`
   |
ferristseng commented 3 years ago

I think it should be already. Which version and backend (hyper or actix) are you using?

kallisti5 commented 3 years ago

default (hyper I think?) ipfs-api version is 0.11.

ferristseng commented 3 years ago

Ahh okay, this should be added in the next release already. You can try pulling down the code in master and seeing if that resolves, but there might be breaking changes.