message: Handle regular and player error objects
  There is a message given alongside most API errors, but it has been
  thrown away until now. This commit presents the full JSON object to the
  end consumer of the error (see
  https://developer.spotify.com/documentation/web-api/reference/object-model/#error-object)
diff: @@ -39,10 +39,21 @@ lazy_static! {
  pub static ref CLIENT: Client = Client::new();
  }
  /// Describes API errors
  -#[derive(Debug)]
  +#[derive(Debug, Deserialize)]
  pub enum ApiError {
  Unauthorized,
  RateLimited(Option<usize>),
  + #[serde(alias = "error")]
  + RegularError {
  + status: u16,
  + message: String,
  + },
  + #[serde(alias = "error")]
  + PlayerError {
  + status: u16,
  + message: String,
  + reason: String,
  + },
  Other(u16),
  }
  impl failure::Fail for ApiError {}
  @@ -57,12 +68,24 @@ impl fmt::Display for ApiError {
  write!(f, "Exceeded API request limit")
  }
  }
  + ApiError::RegularError { status, message } => {
  + write!(f, "Spotify API error code {}: {}", status, message)
  + }
  + ApiError::PlayerError {
  + status,
  + message,
  + reason,
  + } => write!(
  + f,
  + "Spotify API error code {} {}: {}",
  + status, reason, message
  + ),
  ApiError::Other(s) => write!(f, "Spotify API reported error code {}", s),
  }
  }
  }
  -impl From<&reqwest::Response> for ApiError {
  - fn from(response: &reqwest::Response) -> Self {
  +impl ApiError {
  + async fn from_response(response: reqwest::Response) -> Self {
  match response.status() {
  StatusCode::UNAUTHORIZED => ApiError::Unauthorized,
  StatusCode::TOO_MANY_REQUESTS => {
  @@ -72,6 +95,12 @@ impl From<&reqwest::Response> for ApiError {
  ApiError::RateLimited(None)
  }
  }
  + status @ StatusCode::FORBIDDEN | status @ StatusCode::NOT_FOUND => {
  + match response.json::<ApiError>().await {
  + Ok(reason) => reason,
  + Err(_) => ApiError::Other(status.as_u16()),
  + }
  + }
  status => ApiError::Other(status.as_u16()),
  }
  }
  @@ -171,7 +200,9 @@ impl Spotify {
  ))),
  }
  } else {
  - Err(failure::Error::from(ApiError::from(&response)))
  + Err(failure::Error::from(
  + ApiError::from_response(response).await,
  + ))
  }
  }
  ///send get request
  