use crate::userscript_api::include::{LuaError, LuaExternalError};
use std::path::PathBuf;
use thiserror::Error as ThisError;
#[derive(ThisError, Debug)]
pub enum Error {
#[error("invalid path `{path}`: {source}")]
InvalidPath {
path: PathBuf,
source: std::io::Error,
},
#[error("failed to list dir {}: {source}", path.to_string_lossy())]
ReadDirError {
path: PathBuf,
source: std::io::Error,
},
#[error("expected a directory, but got {path}")]
NotADirectory {
path: PathBuf,
},
}
impl From<Error> for LuaError {
fn from(value: Error) -> Self {
value.into_lua_err()
}
}