mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Add catch(...) exceptions to catch unknown exceptions in NC bluetooth adapter
PiperOrigin-RevId: 518902703
This commit is contained in:
committed by
Copybara-Service
parent
3f1b0c81e3
commit
e232149008
@@ -96,6 +96,8 @@ BluetoothAdapter::BluetoothAdapter() : windows_bluetooth_adapter_(nullptr) {
|
||||
} catch (const winrt::hresult_error &error) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code()
|
||||
<< ": " << winrt::to_string(error.message());
|
||||
} catch (...) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": unknown error.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +156,9 @@ bool BluetoothAdapter::SetStatus(Status status) {
|
||||
<< winrt::to_string(ex.message());
|
||||
|
||||
return false;
|
||||
} catch (...) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": unknown error.";
|
||||
return false;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Successfully set the radio state to "
|
||||
@@ -180,6 +185,9 @@ bool BluetoothAdapter::IsEnabled() const {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": "
|
||||
<< winrt::to_string(ex.message());
|
||||
return false;
|
||||
} catch (...) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": unknown error.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,6 +210,9 @@ bool BluetoothAdapter::IsExtendedAdvertisingSupported() const {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": "
|
||||
<< winrt::to_string(ex.message());
|
||||
return false;
|
||||
} catch (...) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": unknown error.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,6 +738,9 @@ std::string BluetoothAdapter::GetMacAddress() const {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": "
|
||||
<< winrt::to_string(ex.message());
|
||||
return "";
|
||||
} catch (...) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": unknown error.";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user