| 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 ff601f927851040566861b866ac35d00f4de67ae..7a99cc27217e6f41e4aafaf9f7a744046b6ee980 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp
|
| @@ -9,6 +9,46 @@
|
|
|
| namespace blink {
|
|
|
| +DOMException* BluetoothError::take(ScriptPromiseResolver*, const mojom::WebBluetoothError& webError)
|
| +{
|
| + switch (webError) {
|
| + case mojom::WebBluetoothError::SUCCESS:
|
| + ASSERT_NOT_REACHED();
|
| + return DOMException::create(UnknownError);
|
| +#define MAP_ERROR(enumeration, name, message) \
|
| + case mojom::WebBluetoothError::enumeration: \
|
| + return DOMException::create(name, message)
|
| +
|
| + // InvalidModificationErrors:
|
| + MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, "GATT Error: invalid attribute length.");
|
| +
|
| + // InvalidStateErrors:
|
| + MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, "GATT Service no longer exists.");
|
| + MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, "GATT Characteristic no longer exists.");
|
| +
|
| + // NetworkErrors:
|
| + MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, "Bluetooth Device is no longer in range.");
|
| + MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired.");
|
| + MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, "GATT operation already in progress.");
|
| +
|
| + // NotSupportedErrors:
|
| + MAP_ERROR(GATT_UNKNOWN_ERROR, NotSupportedError, "GATT Error Unknown.");
|
| + MAP_ERROR(GATT_UNKNOWN_FAILURE, NotSupportedError, "GATT operation failed for unknown reason.");
|
| + MAP_ERROR(GATT_NOT_PERMITTED, NotSupportedError, "GATT operation not permitted.");
|
| + MAP_ERROR(GATT_NOT_SUPPORTED, NotSupportedError, "GATT Error: Not supported.");
|
| + MAP_ERROR(GATT_UNTRANSLATED_ERROR_CODE, NotSupportedError, "GATT Error: Unknown GattErrorCode.");
|
| +
|
| + // SecurityErrors:
|
| + MAP_ERROR(GATT_NOT_AUTHORIZED, SecurityError, "GATT operation not authorized.");
|
| + MAP_ERROR(BLACKLISTED_WRITE, SecurityError, "writeValue() called on blacklisted object marked exclude-writes. https://goo.gl/4NeimX");
|
| +
|
| +#undef MAP_ERROR
|
| + }
|
| +
|
| + ASSERT_NOT_REACHED();
|
| + return DOMException::create(UnknownError);
|
| +}
|
| +
|
| DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothError& webError)
|
| {
|
| switch (webError) {
|
| @@ -65,7 +105,6 @@ DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothErr
|
| MAP_ERROR(GATTNotAuthorized, SecurityError, "GATT operation not authorized.");
|
| MAP_ERROR(BlacklistedCharacteristicUUID, SecurityError, "getCharacteristic(s) called with blacklisted UUID. https://goo.gl/4NeimX");
|
| MAP_ERROR(BlacklistedRead, SecurityError, "readValue() called on blacklisted object marked exclude-reads. https://goo.gl/4NeimX");
|
| - MAP_ERROR(BlacklistedWrite, SecurityError, "writeValue() called on blacklisted object marked exclude-writes. https://goo.gl/4NeimX");
|
| MAP_ERROR(NotAllowedToAccessService, SecurityError, "Origin is not allowed to access the service. Remember to add the service to a filter or to optionalServices in requestDevice().");
|
| MAP_ERROR(RequestDeviceWithBlacklistedUUID, SecurityError, "requestDevice() called with a filter containing a blacklisted UUID. https://goo.gl/4NeimX");
|
| MAP_ERROR(RequestDeviceWithUniqueOrigin, SecurityError, "requestDevice() called from sandboxed or otherwise unique origin.");
|
|
|