#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid package: {0}")]
Invalid(String),
#[error("verification failed: {0}")]
Verify(String),
#[error("{id} is pinned to another author ({pinned}); this package is signed by {got}")]
AuthorChanged {
id: String,
pinned: String,
got: String,
},
#[error("{id} {have} is installed; {got} is not newer")]
NotNewer {
id: String,
have: String,
got: String,
},
#[error("sandbox: {0}")]
Sandbox(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("process: {0}")]
Process(String),
#[error(transparent)]
Io(#[from] std::io::Error),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
pub(crate) fn invalid(m: impl Into<String>) -> Error {
Error::Invalid(m.into())
}