summaryrefslogtreecommitdiff
path: root/src/auth.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-09-10 16:58:58 +0200
committerHampusM <hampus@hampusmat.com>2022-09-10 16:58:58 +0200
commit4b2228d758d0962dd181b8af93cdfcb8e6a78c6e (patch)
tree7aaef8f7ec7ec935f4958d6cf80299547e925d59 /src/auth.rs
parentc71ff70ffec328935b9ca4492e313b4a480d7ec7 (diff)
refactor: add auth prompt handler errors
Diffstat (limited to 'src/auth.rs')
-rw-r--r--src/auth.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/auth.rs b/src/auth.rs
index 4af4997..be9680b 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -1,6 +1,5 @@
//! Deezer API authentication.
use std::convert::Infallible;
-use std::error::Error;
use std::fmt::Display;
use std::net::ToSocketAddrs;
use std::time::Duration;
@@ -48,7 +47,7 @@ pub struct AuthPromptHandler
/// Handle for the running authentication prompt handler.
///
/// Finishes when a single authentication has occurred.
- pub handler: JoinHandle<Result<AuthCode, Box<dyn Error + Send + Sync>>>,
+ pub handler: JoinHandle<Result<AuthCode, AuthPromptHandlerError>>,
}
impl AuthPromptHandler
@@ -96,7 +95,8 @@ impl AuthPromptHandler
} => Ok(auth_code)
}?;
- Ok(opt_auth_code.map_or_else(|| Err("No auth code was received"), Ok)?)
+ opt_auth_code
+ .map_or_else(|| Err(AuthPromptHandlerError::NoAuthCodeReceived), Ok)
});
Ok(Self {