Merge pull request #198 from librespot-org/500_error

Add 5xx error panic
This commit is contained in:
Colm 2018-04-12 20:52:47 +01:00 committed by GitHub
commit 03de235d2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

14
Cargo.lock generated
View file

@ -1,10 +1,3 @@
[root]
name = "librespot-protocol"
version = "0.1.0"
dependencies = [
"protobuf 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "aho-corasick"
version = "0.6.4"
@ -506,6 +499,13 @@ dependencies = [
"portaudio-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "librespot-protocol"
version = "0.1.0"
dependencies = [
"protobuf 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "linear-map"
version = "1.2.0"

View file

@ -189,7 +189,9 @@ impl MercuryManager {
payload: pending.parts,
};
if response.status_code >= 400 {
if response.status_code >= 500 {
panic!("Spotify servers returned an error. Restart librespot.");
} else if response.status_code >= 400 {
warn!("error {} for uri {}", response.status_code, &response.uri);
if let Some(cb) = pending.callback {
let _ = cb.send(Err(MercuryError));