github_workflow_update/
error.rs

1// Copyright (C) 2022 Leandro Lisboa Penz <lpenz@lpenz.org>
2// This file is subject to the terms and conditions defined in
3// file 'LICENSE', which is part of this source code package.
4
5//! [`Error`] and [`Result`] types.
6
7use reqwest;
8use serde_json;
9
10use thiserror;
11
12pub type Result<T, E = Error> = core::result::Result<T, E>;
13
14#[derive(thiserror::Error, Debug)]
15pub enum Error {
16    // Own errors
17    #[error("updater not found for {0}")]
18    UpdaterNotFound(String),
19    #[error("unable to parse version in {0}")]
20    VersionParsing(String),
21    #[error("{1} while getting {0}")]
22    HttpError(String, reqwest::StatusCode),
23    #[error("{0} while parsing json")]
24    JsonParsing(String),
25
26    // Forwarded errors
27    #[error(transparent)]
28    JsonError(#[from] serde_json::Error),
29    #[error(transparent)]
30    ReqwestError(#[from] reqwest::Error),
31}