ipfs_api_backend_hyper/
error.rs

1// Copyright 2021 rust-ipfs-api Developers
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7//
8
9use thiserror::Error;
10
11#[derive(Debug, Error)]
12pub enum Error {
13    #[error("api returned error `{0}`")]
14    Api(ipfs_api_prelude::ApiError),
15
16    #[error("hyper client error `{0}`")]
17    Client(#[from] hyper::Error),
18
19    #[error("http error `{0}`")]
20    Http(#[from] http::Error),
21
22    #[error("ipfs client error `{0}`")]
23    IpfsClientError(#[from] ipfs_api_prelude::Error),
24}
25
26impl From<ipfs_api_prelude::ApiError> for Error {
27    fn from(err: ipfs_api_prelude::ApiError) -> Self {
28        Error::Api(err)
29    }
30}