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 "config.h" | 5 #include "config.h" |
6 #include "modules/bluetooth/BluetoothError.h" | 6 #include "modules/bluetooth/BluetoothError.h" |
7 | 7 |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 DOMException* BluetoothError::take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoo
thError> webError) | 13 DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothErr
or& webError) |
14 { | 14 { |
15 switch (*webError) { | 15 switch (webError) { |
16 #define MAP_ERROR(enumeration, name, message) \ | 16 #define MAP_ERROR(enumeration, name, message) \ |
17 case WebBluetoothError::enumeration: \ | 17 case WebBluetoothError::enumeration: \ |
18 return DOMException::create(name, message) | 18 return DOMException::create(name, message) |
19 | 19 |
20 // InvalidModificationErrors: | 20 // InvalidModificationErrors: |
21 MAP_ERROR(GATTInvalidAttributeLength, InvalidModificationError, "GATT Er
ror: invalid attribute length."); | 21 MAP_ERROR(GATTInvalidAttributeLength, InvalidModificationError, "GATT Er
ror: invalid attribute length."); |
22 | 22 |
23 // InvalidStateErrors: | 23 // InvalidStateErrors: |
24 MAP_ERROR(ServiceNoLongerExists, InvalidStateError, "GATT Service no lon
ger exists."); | 24 MAP_ERROR(ServiceNoLongerExists, InvalidStateError, "GATT Service no lon
ger exists."); |
25 MAP_ERROR(CharacteristicNoLongerExists, InvalidStateError, "GATT Charact
eristic no longer exists."); | 25 MAP_ERROR(CharacteristicNoLongerExists, InvalidStateError, "GATT Charact
eristic no longer exists."); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 MAP_ERROR(RequestDeviceWithoutFrame, SecurityError, "No window to show t
he requestDevice() dialog."); | 58 MAP_ERROR(RequestDeviceWithoutFrame, SecurityError, "No window to show t
he requestDevice() dialog."); |
59 | 59 |
60 #undef MAP_ERROR | 60 #undef MAP_ERROR |
61 } | 61 } |
62 | 62 |
63 ASSERT_NOT_REACHED(); | 63 ASSERT_NOT_REACHED(); |
64 return DOMException::create(UnknownError); | 64 return DOMException::create(UnknownError); |
65 } | 65 } |
66 | 66 |
67 } // namespace blink | 67 } // namespace blink |
OLD | NEW |