diff --git a/Cargo.toml b/Cargo.toml index 4422ed0..e32e6aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ iri-string = { version = "0.5.0-beta.1", features = ["alloc", "serde", "serde-al mime = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -thiserror = "1.0" time = { version = "0.3.5", features = ["formatting", "parsing"] } [dev-dependencies] diff --git a/src/checked.rs b/src/checked.rs index d722e99..96b4f58 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -1,9 +1,16 @@ use iri_string::types::IriStr; -#[derive(Debug, thiserror::Error)] -#[error("IRI failed host and port check")] +#[derive(Clone, Debug)] pub struct CheckError; +impl std::fmt::Display for CheckError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "IRI failed host and port check") + } +} + +impl std::error::Error for CheckError {} + pub(crate) fn check<'a, T: AsRef>( iri: T, host: &str, diff --git a/src/primitives/unit.rs b/src/primitives/unit.rs index e9f02b0..50c3151 100644 --- a/src/primitives/unit.rs +++ b/src/primitives/unit.rs @@ -242,11 +242,18 @@ enum Length { Meters, } -#[derive(Clone, Debug, thiserror::Error)] -#[error("Could not parse units")] +#[derive(Clone, Debug)] /// The error type produced when a Length cannot be parsed struct LengthError; +impl std::fmt::Display for LengthError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Could not parse units") + } +} + +impl std::error::Error for LengthError {} + impl Length { fn is_centimeters(&self) -> bool { matches!(self, Length::Centimeters) diff --git a/src/primitives/xsd_duration.rs b/src/primitives/xsd_duration.rs index 244ef1f..cbc3f79 100644 --- a/src/primitives/xsd_duration.rs +++ b/src/primitives/xsd_duration.rs @@ -45,10 +45,17 @@ pub struct XsdDuration(pub time::Duration); /// The error type produced when an XsdDuration cannot be parsed -#[derive(Clone, Debug, thiserror::Error)] -#[error("Error parsing Duration")] +#[derive(Clone, Debug)] pub struct XsdDurationError; +impl std::fmt::Display for XsdDurationError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Could not parse Duration") + } +} + +impl std::error::Error for XsdDurationError {} + impl XsdDuration { /// Create a new XsdDuration from a time::Duration pub fn new(duration: time::Duration) -> Self {