mirror of https://github.com/Trivernis/nenv
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.
25 lines
444 B
Rust
25 lines
444 B
Rust
use std::io;
|
|
|
|
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())
|
|
}
|
|
}
|