Move the impls for PollError into error.rs

These should have been moved when error.rs was created but were missed.
This commit is contained in:
Glenn Griffin
2019-11-21 10:29:33 -08:00
parent d63396a740
commit 25ba7f0b1f
2 changed files with 22 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
//! Module containing types related to delegates.
use crate::error::{PollError, RefreshError};
use crate::error::{RefreshError};
use std::error::Error as StdError;
use std::fmt;
@@ -43,27 +43,6 @@ impl fmt::Display for PollInformation {
}
}
impl fmt::Display for PollError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self {
PollError::HttpError(ref err) => err.fmt(f),
PollError::Expired(ref date) => writeln!(f, "Authentication expired at {}", date),
PollError::AccessDenied => "Access denied by user".fmt(f),
PollError::TimedOut => "Timed out waiting for token".fmt(f),
PollError::Other(ref s) => format!("Unknown server error: {}", s).fmt(f),
}
}
}
impl StdError for PollError {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
match *self {
PollError::HttpError(ref e) => Some(e),
_ => None,
}
}
}
/// A partially implemented trait to interact with the `Authenticator`
///
/// The only method that needs to be implemented manually is `present_user_code(...)`,