linux-rust: catch errors

This commit is contained in:
Kavish Devar
2025-10-22 20:16:08 +05:30
parent e5c2419ef6
commit fec226336c
2 changed files with 16 additions and 19 deletions

View File

@@ -24,7 +24,4 @@ opt-level = "s"
lto = true lto = true
codegen-units = 1 codegen-units = 1
panic = "abort" panic = "abort"
[profile.release-stripped]
inherits = "release"
strip = true strip = true

View File

@@ -31,35 +31,35 @@ impl AirPodsDevice {
} }
info!("Sending handshake"); info!("Sending handshake");
aacp_manager.send_handshake().await.expect( if let Err(e) = aacp_manager.send_handshake().await {
"Failed to send handshake to AirPods device", error!("Failed to send handshake to AirPods device: {}", e);
); }
sleep(Duration::from_millis(100)).await; sleep(Duration::from_millis(100)).await;
info!("Setting feature flags"); info!("Setting feature flags");
aacp_manager.send_set_feature_flags_packet().await.expect( if let Err(e) = aacp_manager.send_set_feature_flags_packet().await {
"Failed to set feature flags", error!("Failed to set feature flags: {}", e);
); }
sleep(Duration::from_millis(100)).await; sleep(Duration::from_millis(100)).await;
info!("Requesting notifications"); info!("Requesting notifications");
aacp_manager.send_notification_request().await.expect( if let Err(e) = aacp_manager.send_notification_request().await {
"Failed to request notifications", error!("Failed to request notifications: {}", e);
); }
info!("sending some packet"); info!("sending some packet");
aacp_manager.send_some_packet().await.expect( if let Err(e) = aacp_manager.send_some_packet().await {
"Failed to send some packet", error!("Failed to send some packet: {}", e);
); }
info!("Requesting Proximity Keys: IRK and ENC_KEY"); info!("Requesting Proximity Keys: IRK and ENC_KEY");
aacp_manager.send_proximity_keys_request( if let Err(e) = aacp_manager.send_proximity_keys_request(
vec![ProximityKeyType::Irk, ProximityKeyType::EncKey], vec![ProximityKeyType::Irk, ProximityKeyType::EncKey],
).await.expect( ).await {
"Failed to request proximity keys", error!("Failed to request proximity keys: {}", e);
); }
let session = bluer::Session::new().await.expect("Failed to get bluer session"); let session = bluer::Session::new().await.expect("Failed to get bluer session");
let adapter = session.default_adapter().await.expect("Failed to get default adapter"); let adapter = session.default_adapter().await.expect("Failed to get default adapter");