diff options
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/errors.rs b/src/errors.rs index 544c391..d935c49 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,17 +1,17 @@ use rocket::http::ContentType; use rocket::request::Request; use rocket::response::{self, Responder, Response}; -use rspotify::client::ApiError; -use rspotify::oauth2::SpotifyOAuth; +use rspotify::client::ClientError; +use rspotify::client::Spotify; use std::collections::HashMap; use std::io::Cursor; use std::sync::{MutexGuard, PoisonError}; -use tokio_postgres::error::Error as DbError; +use tokio_postgres::Error as DbError; #[derive(Debug)] pub enum Error { Postgres(DbError), - Spotify(ApiError), + Spotify(ClientError), Misc(String), } impl From<DbError> for Error { @@ -19,8 +19,8 @@ impl From<DbError> for Error { Error::Postgres(error) } } -impl From<ApiError> for Error { - fn from(error: ApiError) -> Self { +impl From<ClientError> for Error { + fn from(error: ClientError) -> Self { Error::Spotify(error) } } @@ -34,13 +34,13 @@ impl From<String> for Error { Error::Misc(error) } } -impl<'a> From<PoisonError<MutexGuard<'a, HashMap<String, SpotifyOAuth>>>> for Error { - fn from(error: PoisonError<MutexGuard<'a, HashMap<String, SpotifyOAuth>>>) -> Self { +impl<'a> From<PoisonError<MutexGuard<'a, HashMap<String, Spotify>>>> for Error { + fn from(error: PoisonError<MutexGuard<'a, HashMap<String, Spotify>>>) -> Self { Error::Misc(format!("failed to lock the client mutex: {:?}", error)) } } -impl<'a> From<PoisonError<MutexGuard<'a, postgres::Client>>> for Error { - fn from(error: PoisonError<MutexGuard<'a, postgres::Client>>) -> Self { +impl<'a> From<PoisonError<MutexGuard<'a, tokio_postgres::Client>>> for Error { + fn from(error: PoisonError<MutexGuard<'a, tokio_postgres::Client>>) -> Self { Error::Misc(format!("failed to lock the client mutex: {:?}", error)) } } |