ant_bootstrap/
error.rs

1// Copyright 2024 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use thiserror::Error;
10
11#[derive(Debug, Error)]
12pub enum Error {
13    #[error("Failed to obtain any bootstrap peers")]
14    NoBootstrapPeersFound,
15    #[error("Failed to parse cache data")]
16    FailedToParseCacheData,
17    #[error("Could not obtain data directory")]
18    CouldNotObtainDataDir,
19    #[error("Invalid bootstrap cache directory")]
20    InvalidBootstrapCacheDir,
21    #[error("Could not obtain bootstrap addresses from {0} after {1} retries")]
22    FailedToObtainAddrsFromUrl(String, usize),
23    #[error("Failed to parse Url")]
24    FailedToParseUrl,
25    #[error("IO error: {0}")]
26    Io(#[from] std::io::Error),
27    #[error("JSON error: {0}")]
28    Json(#[from] serde_json::Error),
29    #[error("HTTP error: {0}")]
30    Http(#[from] reqwest::Error),
31    #[error("Lock error")]
32    LockError,
33}
34
35pub type Result<T> = std::result::Result<T, Error>;