diff --git a/src/sharry/api/id.rs b/src/sharry/api/id.rs index cd4d6a3..6f9121d 100644 --- a/src/sharry/api/id.rs +++ b/src/sharry/api/id.rs @@ -4,8 +4,6 @@ use log::{debug, trace}; use regex::Regex; use serde::{Deserialize, Serialize}; -use crate::error; - #[derive(Serialize, Deserialize, Debug, Clone)] pub struct AliasID(String); @@ -52,9 +50,9 @@ impl fmt::Display for FileID { } impl TryFrom for FileID { - type Error = error::Error; + type Error = crate::Error; - fn try_from(value: String) -> error::Result { + fn try_from(value: String) -> crate::Result { /// Pattern breakdown: /// - `^([^:/?#]+)://` – scheme (anything but `:/?#`) + `"://"` /// - `([^/?#]+)` – authority/host (anything but `/?#`) @@ -83,7 +81,7 @@ impl TryFrom for FileID { Ok(result) } else { - Err(error::Error::mismatch( + Err(crate::Error::mismatch( ":///api/v2/alias/upload//files/tus/", value, )) @@ -143,7 +141,7 @@ mod tests { let err = FileID::try_from(bad.to_string()).expect_err("URL should not parse"); // make sure it's the Mismatch variant, and that it contains the original input match err { - error::Error::Mismatch { expected, actual } => { + crate::Error::Mismatch { expected, actual } => { assert_eq!( expected, ":///api/v2/alias/upload//files/tus/", "Error should output expected format"