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/web_api/error.rs

26 lines
470 B
Rust

use std::io;
use lazy_static::__Deref;
use miette::Diagnostic;
use thiserror::Error;
pub type ApiResult<T> = Result<T, ApiError>;
#[derive(Debug, Error, Diagnostic)]
pub enum ApiError {
#[error(transparent)]
Reqwest(#[from] reqwest::Error),
#[error(transparent)]
Io(#[from] io::Error),
#[error("{0}")]
Other(#[help] String),
}
impl ApiError {
pub fn other<S: ToString>(error: S) -> Self {
Self::Other(error.to_string())
}
}