mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #138 from librespot-org/authpanic
Add error message to auth failure case
This commit is contained in:
commit
874cc541de
1 changed files with 6 additions and 1 deletions
|
@ -34,6 +34,7 @@ pub fn authenticate(
|
|||
device_id: String,
|
||||
) -> Box<Future<Item = (Transport, Credentials), Error = io::Error>> {
|
||||
use protocol::authentication::{APWelcome, ClientResponseEncrypted, CpuFamily, Os};
|
||||
use protocol::keyexchange::APLoginFailed;
|
||||
|
||||
let mut packet = ClientResponseEncrypted::new();
|
||||
packet
|
||||
|
@ -79,7 +80,11 @@ pub fn authenticate(
|
|||
Ok((transport, reusable_credentials))
|
||||
}
|
||||
|
||||
Some((0xad, _)) => panic!("Authentication failed"),
|
||||
Some((0xad, data)) => {
|
||||
let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref()).unwrap();
|
||||
panic!("Authentication failed with reason: {:?}", error_data.get_error_code())
|
||||
}
|
||||
|
||||
Some((cmd, _)) => panic!("Unexpected packet {:?}", cmd),
|
||||
None => panic!("EOF"),
|
||||
}),
|
||||
|
|
Loading…
Reference in a new issue