You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nenv/src/error.rs

53 lines
1.1 KiB
Rust

use std::io;
use miette::Diagnostic;
2 years ago
use thiserror::Error;
use crate::{
mapper::error::MapperError,
repository::{config::ConfigError, extract::ExtractError},
web_api::error::ApiError,
};
2 years ago
pub(crate) type LibResult<T> = Result<T>;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error, Diagnostic)]
pub enum Error {
#[error("Failed to call nodejs.com api: {0}")]
Web(
#[from]
#[source]
#[diagnostic_source]
ApiError,
),
#[error("Failed to extract archive: {0}")]
Extract(
#[from]
#[source]
#[diagnostic_source]
ExtractError,
),
#[error("Failed to load config file: {0}")]
Config(
#[from]
#[source]
#[diagnostic_source]
ConfigError,
),
#[error("Mapper failed: {0}")]
Mapper(
#[from]
#[source]
#[diagnostic_source]
MapperError,
),
#[error("Failed to work with json: {0}")]
Json(#[from] serde_json::Error),
#[error("IO Error: {0}")]
Io(#[from] io::Error),
}