From 17fc923d7b749d1817ab26e52ab6eecfb6999eac Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 11 May 2022 23:13:39 +0200 Subject: Print which unexpected event it is. --- nrf-softdevice/src/ble/central.rs | 2 +- nrf-softdevice/src/ble/gatt_client.rs | 8 ++++---- nrf-softdevice/src/ble/l2cap.rs | 4 ++-- nrf-softdevice/src/ble/peripheral.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nrf-softdevice/src/ble/central.rs b/nrf-softdevice/src/ble/central.rs index c30da39..86a97a4 100644 --- a/nrf-softdevice/src/ble/central.rs +++ b/nrf-softdevice/src/ble/central.rs @@ -88,7 +88,7 @@ pub async fn connect( } } raw::BLE_GAP_EVTS_BLE_GAP_EVT_TIMEOUT => Err(ConnectError::Timeout), - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await?; diff --git a/nrf-softdevice/src/ble/gatt_client.rs b/nrf-softdevice/src/ble/gatt_client.rs index 5affd5f..fca71fb 100644 --- a/nrf-softdevice/src/ble/gatt_client.rs +++ b/nrf-softdevice/src/ble/gatt_client.rs @@ -157,7 +157,7 @@ pub(crate) async fn discover_service( } } } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await @@ -201,7 +201,7 @@ async fn discover_characteristics( }); Ok(v) } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await @@ -245,7 +245,7 @@ async fn discover_descriptors( }); Ok(v) } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await @@ -648,7 +648,7 @@ pub(crate) async fn att_mtu_exchange(conn: &Connection, mtu: u16) -> Result<(), Ok(()) } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await diff --git a/nrf-softdevice/src/ble/l2cap.rs b/nrf-softdevice/src/ble/l2cap.rs index 95c0ddd..33a2baa 100644 --- a/nrf-softdevice/src/ble/l2cap.rs +++ b/nrf-softdevice/src/ble/l2cap.rs @@ -196,7 +196,7 @@ impl L2cap

{ let _evt = &l2cap_evt.params.ch_setup_refused; Err(SetupError::Refused) } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await @@ -290,7 +290,7 @@ impl L2cap

{ None } } - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await diff --git a/nrf-softdevice/src/ble/peripheral.rs b/nrf-softdevice/src/ble/peripheral.rs index 185ab86..5c8ee41 100644 --- a/nrf-softdevice/src/ble/peripheral.rs +++ b/nrf-softdevice/src/ble/peripheral.rs @@ -263,7 +263,7 @@ pub async fn advertise( match (*ble_evt).header.evt_id as u32 { raw::BLE_GAP_EVTS_BLE_GAP_EVT_TIMEOUT => Err(AdvertiseError::Timeout), raw::BLE_GAP_EVTS_BLE_GAP_EVT_ADV_SET_TERMINATED => Err(AdvertiseError::Timeout), - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await; @@ -318,7 +318,7 @@ pub async fn advertise_connectable( } raw::BLE_GAP_EVTS_BLE_GAP_EVT_TIMEOUT => Err(AdvertiseError::Timeout), raw::BLE_GAP_EVTS_BLE_GAP_EVT_ADV_SET_TERMINATED => Err(AdvertiseError::Timeout), - _ => unreachable!(), + e => panic!("unexpected event {}", e), } }) .await; -- cgit v1.2.3