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.
23 lines
471 B
Rust
23 lines
471 B
Rust
2 years ago
|
use std::path::PathBuf;
|
||
|
|
||
|
use miette::Diagnostic;
|
||
|
use thiserror::Error;
|
||
|
|
||
|
pub type AppResult<T> = std::result::Result<T, AppError>;
|
||
|
|
||
|
#[derive(Error, Diagnostic, Debug)]
|
||
|
pub enum AppError {
|
||
|
#[error("Error while evaluating nu script")]
|
||
|
#[diagnostic()]
|
||
|
Nu(miette::Error),
|
||
|
|
||
|
#[error("Could not find the script file {0}")]
|
||
|
ScriptNotFound(PathBuf),
|
||
|
}
|
||
|
|
||
|
impl From<miette::Error> for AppError {
|
||
|
fn from(e: miette::Error) -> Self {
|
||
|
Self::Nu(e)
|
||
|
}
|
||
|
}
|