Remove thiserror
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Aode (Lion) 2022-01-17 14:09:00 -06:00
parent f343e4a959
commit 36a7f9ddcf
4 changed files with 27 additions and 7 deletions

View file

@ -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]

View file

@ -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<IriStr>>(
iri: T,
host: &str,

View file

@ -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)

View file

@ -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 {