diff --git a/Cargo.toml b/Cargo.toml index f8c26175..a4d50df2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "urlshortener" -version = "3.0.2" +version = "3.1.0" edition = "2018" authors = ["Victor Polevoy "] description = "A very simple url shortener client library" diff --git a/src/providers.rs b/src/providers.rs index 672fbaa5..7e02d400 100644 --- a/src/providers.rs +++ b/src/providers.rs @@ -17,6 +17,17 @@ pub enum ProviderError { Deserialize, } +impl std::fmt::Display for ProviderError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match *self { + Self::Connection => write!(f, "A connection problem occured when connecting to a provided."), + Self::Deserialize => write!(f, "Couldn't deserialize the shortened URL from the response."), + } + } +} + +impl std::error::Error for ProviderError {} + /// A slice of all `Provider` variants which do not require authentication. /// This list is in order of provider quality. ///