OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/bluetooth/BluetoothError.h" | 5 #include "modules/bluetooth/BluetoothError.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothErr
or& webError) | 12 DOMException* BluetoothError::take(ScriptPromiseResolver*, const mojom::WebBluet
oothError& webError) |
13 { | 13 { |
14 switch (webError) { | 14 switch (webError) { |
15 case WebBluetoothError::SUCCESS: | 15 case mojom::WebBluetoothError::SUCCESS: |
16 ASSERT_NOT_REACHED(); | 16 ASSERT_NOT_REACHED(); |
17 return DOMException::create(UnknownError); | 17 return DOMException::create(UnknownError); |
18 #define MAP_ERROR(enumeration, name, message) \ | 18 #define MAP_ERROR(enumeration, name, message) \ |
19 case WebBluetoothError::enumeration: \ | 19 case mojom::WebBluetoothError::enumeration: \ |
20 return DOMException::create(name, message) | 20 return DOMException::create(name, message) |
21 | 21 |
22 // InvalidModificationErrors: | 22 // InvalidModificationErrors: |
23 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, "GATT
Error: invalid attribute length."); | 23 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, "GATT
Error: invalid attribute length."); |
24 | 24 |
25 // InvalidStateErrors: | 25 // InvalidStateErrors: |
26 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, "GATT Service no
longer exists."); | 26 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, "GATT Service no
longer exists."); |
27 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, "GATT Char
acteristic no longer exists."); | 27 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, "GATT Char
acteristic no longer exists."); |
28 | 28 |
29 // NetworkErrors: | 29 // NetworkErrors: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho
w the requestDevice() dialog."); | 76 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho
w the requestDevice() dialog."); |
77 | 77 |
78 #undef MAP_ERROR | 78 #undef MAP_ERROR |
79 } | 79 } |
80 | 80 |
81 ASSERT_NOT_REACHED(); | 81 ASSERT_NOT_REACHED(); |
82 return DOMException::create(UnknownError); | 82 return DOMException::create(UnknownError); |
83 } | 83 } |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
OLD | NEW |