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

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

Issue 2721233002: bluetooth: Better disconnected error messages for characteristic retrieval. (Closed)
Patch Set: Address dcheng's comments 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
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 aae000e20e7bed95a7af8489eb10f1ee25282d57..b2f37308e39c06b5a4492be5d41eec2973b4e697 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp
@@ -19,14 +19,6 @@
namespace blink {
-namespace {
-
-const char kGATTServerNotConnected[] =
- "GATT Server is disconnected. Cannot retrieve services. (Re)connect first "
- "with `device.gatt.connect`.";
-
-} // namespace
-
BluetoothRemoteGATTServer::BluetoothRemoteGATTServer(BluetoothDevice* device)
: m_device(device), m_connected(false) {}
@@ -107,8 +99,8 @@ void BluetoothRemoteGATTServer::GetPrimaryServicesCallback(
// If the device is disconnected, reject.
if (!RemoveFromActiveAlgorithms(resolver)) {
- resolver->reject(
- DOMException::create(NetworkError, kGATTServerNotConnected));
+ resolver->reject(BluetoothError::createNotConnectedException(
+ BluetoothOperation::ServicesRetrieval));
return;
}
@@ -182,8 +174,8 @@ ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(
String servicesUUID) {
if (!m_connected) {
return ScriptPromise::rejectWithDOMException(
- scriptState,
- DOMException::create(NetworkError, kGATTServerNotConnected));
+ scriptState, BluetoothError::createNotConnectedException(
+ BluetoothOperation::ServicesRetrieval));
}
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);

Powered by Google App Engine
This is Rietveld 408576698