Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1522)

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 2784373003: bluetooth: macOS: Adding explicit function to log NSError (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.h ('k') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_mac.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index 7ecac69a5de80fbd65ff1be6ca84927c90c777ff..4e9c41a99c570aea33008a117396ed739a3eda49 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -74,6 +74,16 @@ BluetoothUUID BluetoothAdapterMac::BluetoothUUIDWithCBUUID(CBUUID* uuid) {
return device::BluetoothUUID(uuid_c_string);
}
+// static
+std::string BluetoothAdapterMac::String(NSError* error) {
+ if (!error) {
+ return "no error";
+ }
+ return std::string("error domain: ") + base::SysNSStringToUTF8(error.domain) +
+ ", code: " + std::to_string(error.code) + ", description: " +
+ base::SysNSStringToUTF8(error.localizedDescription);
+}
+
BluetoothAdapterMac::BluetoothAdapterMac()
: BluetoothAdapter(),
classic_powered_(false),
@@ -676,7 +686,8 @@ void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral,
error_code = BluetoothDeviceMac::GetConnectErrorCodeFromNSError(error);
}
VLOG(1) << *device_mac << ": Failed to connect to peripheral with error "
- << error << ", error code: " << error_code;
+ << BluetoothAdapterMac::String(error)
+ << ", error code: " << error_code;
device_mac->DidFailToConnectGatt(error_code);
}
@@ -724,14 +735,4 @@ bool BluetoothAdapterMac::DoesCollideWithKnownDevice(
return false;
}
-DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<(std::ostream& out,
- NSError* error) {
- if (!error) {
- return out << "no error";
- }
- return out << "error domain: " << base::SysNSStringToUTF8(error.domain)
- << ", code: " << std::to_string(error.code) << ", description: "
- << base::SysNSStringToUTF8(error.localizedDescription);
-}
-
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.h ('k') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698