use std::error::Error as StdError;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("clipboard not supported on this platform")]
NotSupported,
#[error("clipboard permission denied: {0}")]
PermissionDenied(&'static str),
#[error("clipboard unavailable: {0}")]
Unavailable(&'static str),
#[error("{context}: {source}")]
Platform {
context: &'static str,
#[source]
source: Box<dyn StdError + Send + Sync>,
},
}
impl Error {
pub(crate) fn platform<E>(context: &'static str, err: E) -> Self
where
E: StdError + Send + Sync + 'static,
{
Self::Platform {
context,
source: Box::new(err),
}
}
}