Chromium Code Reviews| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp |
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp |
| index bae9bb8c7879e103ada6a1489139b1bf6fe2c15b..4fe20c8ad5000360757845796d0de9ca36027cbf 100644 |
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp |
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp |
| @@ -7,9 +7,34 @@ |
| #include "core/dom/DOMException.h" |
| #include "core/dom/ExceptionCode.h" |
| +namespace { |
| + |
| +const char kGATTServerNotConnectedBase[] = |
| + "GATT Server is disconnected. " |
| + "Cannot %s. (Re)connect first with `device.gatt.connect`."; |
| +} |
|
dcheng
2017/03/07 08:19:36
Super minor nit:
Add // namespace
And a new line b
ortuno
2017/03/07 22:24:00
Done.
|
| + |
| namespace blink { |
| // static |
| +DOMException* BluetoothError::createNotConnectedException( |
| + BluetoothOperation operation) { |
| + const char* operationString = nullptr; |
| + switch (operation) { |
| + case BluetoothOperation::ServicesRetrieval: |
| + operationString = "retrieve services"; |
| + break; |
| + case BluetoothOperation::CharacteristicsRetrieval: |
| + operationString = "retrieve characteristics"; |
| + break; |
| + } |
| + |
| + return DOMException::create( |
| + NetworkError, |
| + String::format(kGATTServerNotConnectedBase, operationString)); |
| +} |
| + |
| +// static |
| DOMException* BluetoothError::createDOMException( |
| BluetoothErrorCode error, |
| const String& detailedMessage) { |
| @@ -98,13 +123,6 @@ DOMException* BluetoothError::createDOMException( |
| "GATT Server is disconnected. Cannot perform GATT operations."); |
| MAP_ERROR(GATT_SERVER_DISCONNECTED, NetworkError, |
| "GATT Server disconnected while performing a GATT operation."); |
| - MAP_ERROR(GATT_SERVER_DISCONNECTED_WHILE_RETRIEVING_CHARACTERISTICS, |
| - NetworkError, |
| - "GATT Server disconnected while retrieving characteristics."); |
| - MAP_ERROR( |
| - GATT_SERVER_NOT_CONNECTED_CANNOT_RETRIEVE_CHARACTERISTICS, |
| - NetworkError, |
| - "GATT Server is disconnected. Cannot retrieve characteristics."); |
| // NotFoundErrors: |
| MAP_ERROR(WEB_BLUETOOTH_NOT_SUPPORTED, NotFoundError, |