diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 7d365f6e..172339c3 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -34,6 +34,7 @@ pub fn authenticate( device_id: String, ) -> Box> { 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"), }),