use thiserror::Error;
use uuid::Uuid;
#[derive(Debug, Error)]
pub enum Error {
#[error(
"The file you are working with is already open. Please close it and try again. If you are sure no one else if working with it, you can delete the lock file and try again."
)]
LockNotObtained,
#[error("I/O Error: {0}")]
Io(#[from] std::io::Error),
#[error("Package error: {0}")]
Zip(#[from] zip::result::ZipError),
#[error("Error attesting: {0}")]
Attesting(#[from] crate::prelude::attesting::Error),
#[error("The evidence package is corrupt ({0}).")]
CorruptEvidencePackage(String),
#[error("The package manifest is corrupt: {0}")]
InvalidManifest(serde_json::Error),
#[error("Failed to create package: {0}")]
FailedToCreatePackage(serde_json::Error),
#[error("Failed to save test case: {0}")]
FailedToSaveTestCase(serde_json::Error),
#[error("Failed to read test case {1}: {0}")]
InvalidTestCase(serde_json::Error, Uuid),
#[error("Media is missing from the package with hash {0}")]
MediaMissing(String),
#[error(
"Manifest schema validation failed. Perhaps this package is from a newer version of EvidenceAngel."
)]
ManifestSchemaValidationFailed,
#[error(
"Test case schema validation failed. Perhaps this package is from a newer version of EvidenceAngel."
)]
TestCaseSchemaValidationFailed,
#[error("The specified test case doesn't exist")]
DoesntExist(Uuid),
#[error("Export failed: {0}")]
OtherExportError(Box<dyn std::error::Error>),
}
pub type Result<T> = std::result::Result<T, Error>;