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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp

Issue 2564283004: bluetooth: web: Include the UUID in the error message. (Closed)
Patch Set: Addressed issues in code review. Created 4 years 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
Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
index 1fbd1f65bd533253d9e8bd7a020cfb29bbb72f3d..88afaa001b47bbd3ed48dba2a7eb2bc94360afc7 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -113,9 +113,13 @@ class GetPrimaryServicesCallback
public:
GetPrimaryServicesCallback(
BluetoothDevice* device,
+ String servicesUUID,
mojom::blink::WebBluetoothGATTQueryQuantity quantity,
ScriptPromiseResolver* resolver)
- : m_device(device), m_quantity(quantity), m_resolver(resolver) {
+ : m_device(device),
+ m_servicesUUID(servicesUUID),
+ m_quantity(quantity),
+ m_resolver(resolver) {
// We always check that the device is connected before constructing this
// object.
CHECK(m_device->gatt()->connected());
@@ -166,11 +170,20 @@ class GetPrimaryServicesCallback
return;
}
- m_resolver->reject(BluetoothError::take(m_resolver, error));
+ if (!m_servicesUUID.isEmpty() &&
+ BluetoothError::isSameError(
+ error, mojom::blink::WebBluetoothResult::SERVICE_NOT_FOUND)) {
+ m_resolver->reject(BluetoothError::take(
+ m_resolver, error,
+ "No Services matching UUID " + m_servicesUUID + " found in Device."));
+ } else {
+ m_resolver->reject(BluetoothError::take(m_resolver, error));
+ }
}
private:
Persistent<BluetoothDevice> m_device;
+ const String m_servicesUUID;
mojom::blink::WebBluetoothGATTQueryQuantity m_quantity;
const Persistent<ScriptPromiseResolver> m_resolver;
};
@@ -225,7 +238,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(
BluetoothSupplement::fromScriptState(scriptState);
webbluetooth->getPrimaryServices(
device()->id(), static_cast<int32_t>(quantity), servicesUUID,
- new GetPrimaryServicesCallback(device(), quantity, resolver));
+ new GetPrimaryServicesCallback(device(), servicesUUID, quantity,
+ resolver));
return promise;
}

Powered by Google App Engine
This is Rietveld 408576698