-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ModelError
in favour of strongly-typed errors
#327
Changes from all commits
da97c4d
e632496
0b1f78c
5678cf1
48a3e6d
5894f97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use crate::{ | ||
clients::BaseClient, | ||
http::{Form, HttpClient}, | ||
model::ReadTokenCacheError, | ||
params, | ||
sync::Mutex, | ||
ClientResult, Config, Credentials, Token, | ||
|
@@ -95,7 +96,7 @@ impl ClientCredsSpotify { | |
/// * The read token is expired | ||
/// * The cached token is disabled in the config | ||
#[maybe_async] | ||
pub async fn read_token_cache(&self) -> ClientResult<Option<Token>> { | ||
pub async fn read_token_cache(&self) -> Result<Option<Token>, ReadTokenCacheError> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change can be avoided by making this error part of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then all code that deals in I suppose it would technically fit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. My reasoning was that if |
||
if !self.get_config().token_cached { | ||
log::info!("Token cache read ignored (not configured)"); | ||
return Ok(None); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this use
non_exhaustive
, for future-proofing? And why not a tuple struct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could’ve been a tuple struct I suppose — should I change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say we don't really need to future-proof anything here? Not sure what else we would need to add into the error.