use semver::SemVerError;
use thiserror::Error as ThisError;
use std::str::Utf8Error;
#[derive(Debug, ThisError, PartialEq)]
pub enum ManifestError {
#[error(
"{0} can't be read: embedded manifest doesn't contain enough bytes to read field size from prefix"
)]
NotEnoughBytesForPrefix(&'static str),
#[error(
"{0} can't be read: embedded manifest doesn't contain enough bytes to read field of size {1}"
)]
NotEnoughBytesForField(&'static str, usize),
#[error("{0} is an invalid Utf8 string: {1}")]
FieldNotValidUtf8(&'static str, Utf8Error),
#[error("{0} has too big size: {1}")]
TooBigFieldSize(&'static str, u64),
#[error("embedded to the Wasm file version is corrupted: '{0}'")]
ModuleVersionCorrupted(#[from] SemVerError),
#[error("embedded manifest is corrupted: there are some trailing characters")]
ManifestRemainderNotEmpty,
#[error("build time can't be parsed: {0}")]
DateTimeParseError(#[from] chrono::ParseError),
}