pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Platform error: {0}")]
Platform(String),
#[error("Invalid URI scheme: {0}")]
InvalidScheme(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Permission denied: {0}")]
PermissionDenied(String),
#[error("URI scheme '{0}' is already registered")]
AlreadyRegistered(String),
#[error("Unsupported platform")]
UnsupportedPlatform,
#[error("Invalid executable path: {0}")]
InvalidExecutable(String),
}
impl Error {
pub fn platform<S: Into<String>>(msg: S) -> Self {
Error::Platform(msg.into())
}
pub fn permission_denied<S: Into<String>>(msg: S) -> Self {
Error::PermissionDenied(msg.into())
}
}