ipfs_api_backend_actix/
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("actix client payload error `{0}`")]
17    ClientPayload(#[from] awc::error::PayloadError),
18
19    #[error("actix client send request error `{0}`")]
20    ClientSend(#[from] awc::error::SendRequestError),
21
22    #[error("http error `{0}`")]
23    Http(#[from] http::Error),
24
25    #[error("ipfs client error `{0}`")]
26    IpfsClientError(#[from] ipfs_api_prelude::Error),
27}
28
29impl From<ipfs_api_prelude::ApiError> for Error {
30    fn from(err: ipfs_api_prelude::ApiError) -> Self {
31        Error::Api(err)
32    }
33}