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

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

Issue 2680783002: bluetooth: show better error messages for services, characteristics and descriptors (Closed)
Patch Set: Use CreateDOMException instead of take(). 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/BluetoothRemoteGATTDescriptor.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp
index 9bb73d669e97c3512fff7570306fa1b7dd2c5368..f085c6273e11b539ae0cecaaf87671bd01a7f8cb 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.cpp
@@ -38,8 +38,8 @@ void BluetoothRemoteGATTDescriptor::ReadValueCallback(
// If the device is disconnected, reject.
if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) {
- resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
+ resolver->reject(BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
return;
}
@@ -50,7 +50,7 @@ void BluetoothRemoteGATTDescriptor::ReadValueCallback(
m_value = domDataView;
resolver->resolve(domDataView);
} else {
- resolver->reject(BluetoothError::take(resolver, result));
+ resolver->reject(BluetoothError::CreateDOMException(result));
}
}
@@ -59,15 +59,14 @@ ScriptPromise BluetoothRemoteGATTDescriptor::readValue(
if (!getGatt()->connected()) {
return ScriptPromise::rejectWithDOMException(
scriptState,
- BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
+ BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
}
if (!getGatt()->device()->isValidDescriptor(m_descriptor->instance_id)) {
return ScriptPromise::rejectWithDOMException(
- scriptState,
- BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kInvalidDescriptor));
+ scriptState, BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::INVALID_DESCRIPTOR));
}
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
@@ -93,8 +92,8 @@ void BluetoothRemoteGATTDescriptor::WriteValueCallback(
// If the resolver is not in the set of ActiveAlgorithms then the frame
// disconnected so we reject.
if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) {
- resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected));
+ resolver->reject(BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::GATT_SERVER_DISCONNECTED));
return;
}
@@ -102,7 +101,7 @@ void BluetoothRemoteGATTDescriptor::WriteValueCallback(
m_value = BluetoothRemoteGATTUtils::ConvertWTFVectorToDataView(value);
resolver->resolve();
} else {
- resolver->reject(BluetoothError::take(resolver, result));
+ resolver->reject(BluetoothError::CreateDOMException(result));
}
}
@@ -112,15 +111,14 @@ ScriptPromise BluetoothRemoteGATTDescriptor::writeValue(
if (!getGatt()->connected()) {
return ScriptPromise::rejectWithDOMException(
scriptState,
- BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kGATTServerNotConnected));
+ BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::GATT_SERVER_NOT_CONNECTED));
}
if (!getGatt()->device()->isValidDescriptor(m_descriptor->instance_id)) {
return ScriptPromise::rejectWithDOMException(
- scriptState,
- BluetoothRemoteGATTUtils::CreateDOMException(
- BluetoothRemoteGATTUtils::ExceptionType::kInvalidDescriptor));
+ scriptState, BluetoothError::CreateDOMException(
+ mojom::blink::WebBluetoothResult::INVALID_DESCRIPTOR));
}
// Partial implementation of writeValue algorithm:

Powered by Google App Engine
This is Rietveld 408576698