Made token revocation errors more obvious
parent
784c2514ac
commit
3aa708a070
|
@ -242,6 +242,18 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if let SessionCreateError::NoLongerSpotifyError = why {
|
||||||
|
update_message(
|
||||||
|
&ctx,
|
||||||
|
&command,
|
||||||
|
EmbedBuilder::new()
|
||||||
|
.title("Cannot join voice channel")
|
||||||
|
.description("Spoticord no longer has access to your Spotify account. Use </link:1036714850367320136> or go to [the accounts website](https://account.spoticord.com/) to relink your Spotify account.")
|
||||||
|
.status(Status::Error)
|
||||||
|
.build(),
|
||||||
|
).await;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,6 +296,18 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if let SessionCreateError::NoLongerSpotifyError = why {
|
||||||
|
update_message(
|
||||||
|
&ctx,
|
||||||
|
&command,
|
||||||
|
EmbedBuilder::new()
|
||||||
|
.title("Cannot join voice channel")
|
||||||
|
.description("Spoticord no longer has access to your Spotify account. Use </link:1036714850367320136> or go to [the accounts website](https://account.spoticord.com/) to relink your Spotify account.")
|
||||||
|
.status(Status::Error)
|
||||||
|
.build(),
|
||||||
|
).await;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ pub enum SessionCreateError {
|
||||||
#[error("The user has not linked their Spotify account")]
|
#[error("The user has not linked their Spotify account")]
|
||||||
NoSpotifyError,
|
NoSpotifyError,
|
||||||
|
|
||||||
|
#[error("The application no longer has access to the user's Spotify account")]
|
||||||
|
NoLongerSpotifyError,
|
||||||
|
|
||||||
#[error("An error has occured while communicating with the database")]
|
#[error("An error has occured while communicating with the database")]
|
||||||
DatabaseError,
|
DatabaseError,
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,8 @@ impl SpoticordSession {
|
||||||
if let DatabaseError::InvalidStatusCode(code) = why {
|
if let DatabaseError::InvalidStatusCode(code) = why {
|
||||||
if code == 404 {
|
if code == 404 {
|
||||||
return Err(SessionCreateError::NoSpotifyError);
|
return Err(SessionCreateError::NoSpotifyError);
|
||||||
|
} else if code == 400 {
|
||||||
|
return Err(SessionCreateError::NoLongerSpotifyError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue