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

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

Issue 2680783002: bluetooth: show better error messages for services, characteristics and descriptors (Closed)
Patch Set: Created 3 years, 10 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
Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
index cfcd631d0cca6cabcc09bb9e1ecde684298665d4..06b28ec37546367994df235b0e4639168bdc4e2b 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.cpp
@@ -48,6 +48,7 @@ DEFINE_TRACE(BluetoothRemoteGATTService) {
// or with a vector owning the characteristics.
void BluetoothRemoteGATTService::GetCharacteristicsCallback(
const String& serviceInstanceId,
+ const String& requestedCharacteristicUUID,
mojom::blink::WebBluetoothGATTQueryQuantity quantity,
ScriptPromiseResolver* resolver,
mojom::blink::WebBluetoothResult result,
@@ -85,7 +86,14 @@ void BluetoothRemoteGATTService::GetCharacteristicsCallback(
}
resolver->resolve(gattCharacteristics);
} else {
- resolver->reject(BluetoothError::take(resolver, result));
+ if (result == mojom::blink::WebBluetoothResult::CHARACTERISTIC_NOT_FOUND) {
+ resolver->reject(BluetoothError::take(
+ resolver, result, "No Characteristics matching UUID " +
+ requestedCharacteristicUUID +
+ " found in Service with UUID " + uuid() + "."));
+ } else {
+ resolver->reject(BluetoothError::take(resolver, result));
+ }
}
}
@@ -148,8 +156,8 @@ ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(
m_service->instance_id, quantity, characteristicsUUID,
convertToBaseCallback(
WTF::bind(&BluetoothRemoteGATTService::GetCharacteristicsCallback,
- wrapPersistent(this), m_service->instance_id, quantity,
- wrapPersistent(resolver))));
+ wrapPersistent(this), m_service->instance_id,
+ characteristicsUUID, quantity, wrapPersistent(resolver))));
return promise;
}

Powered by Google App Engine
This is Rietveld 408576698