ant_releases/
error.rs

1// Copyright (C) 2025 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
11pub type Result<T> = std::result::Result<T, Error>;
12
13#[derive(Debug, Error)]
14#[allow(missing_docs)]
15pub enum Error {
16    #[error("Cannot parse file name from the URL")]
17    CannotParseFilenameFromUrl,
18    #[error("Unexpected response from crates.io: {0}")]
19    CratesIoResponseError(u16),
20    #[error(transparent)]
21    DateTimeParseError(#[from] chrono::ParseError),
22    #[error("Could not convert API response header links to string")]
23    HeaderLinksToStrError,
24    #[error(transparent)]
25    Io(#[from] std::io::Error),
26    #[error(transparent)]
27    JsonError(#[from] serde_json::Error),
28    #[error("Latest release not found for {0}")]
29    LatestReleaseNotFound(String),
30    #[error("{0}")]
31    PlatformNotSupported(String),
32    #[error("Could not compile the regex statement")]
33    RegexError,
34    #[error(transparent)]
35    ReqwestError(#[from] reqwest::Error),
36    #[error("Release binary {0} was not found")]
37    ReleaseBinaryNotFound(String),
38    #[error(transparent)]
39    SemVerError(#[from] semver::Error),
40    #[error("Could not parse version from tag name")]
41    TagNameVersionParsingFailed,
42    #[error("The URL must point to a zip or gzipped tar archive")]
43    UrlIsNotArchive,
44    #[error("Unknown platform: {0}")]
45    UnknownPlatform(String),
46    #[error(transparent)]
47    ZipError(#[from] zip::result::ZipError),
48}