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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp

Issue 2727683003: bluetooth: Clean up connection errors (Closed)
Patch Set: merge Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, 82 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError,
83 "GATT Service no longer exists."); 83 "GATT Service no longer exists.");
84 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, 84 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError,
85 "GATT Characteristic no longer exists."); 85 "GATT Characteristic no longer exists.");
86 MAP_ERROR(DESCRIPTOR_NO_LONGER_EXISTS, InvalidStateError, 86 MAP_ERROR(DESCRIPTOR_NO_LONGER_EXISTS, InvalidStateError,
87 "GATT Descriptor no longer exists."); 87 "GATT Descriptor no longer exists.");
88 88
89 // NetworkErrors: 89 // NetworkErrors:
90 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError, 90 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError,
91 "Connection already in progress."); 91 "Connection already in progress.");
92 MAP_ERROR(CONNECT_ATTRIBUTE_LENGTH_INVALID, NetworkError,
93 "Write operation exceeds the maximum length of the attribute.");
94 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError, 92 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError,
95 "Authentication canceled."); 93 "Authentication canceled.");
96 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed."); 94 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed.");
97 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError, 95 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError,
98 "Authentication rejected."); 96 "Authentication rejected.");
99 MAP_ERROR(CONNECT_AUTH_TIMEOUT, NetworkError, "Authentication timeout."); 97 MAP_ERROR(CONNECT_AUTH_TIMEOUT, NetworkError, "Authentication timeout.");
100 MAP_ERROR(CONNECT_CONNECTION_CONGESTED, NetworkError,
101 "Remote device connection is congested.");
102 MAP_ERROR(CONNECT_INSUFFICIENT_ENCRYPTION, NetworkError,
103 "Insufficient encryption for a given operation");
104 MAP_ERROR(
105 CONNECT_OFFSET_INVALID, NetworkError,
106 "Read or write operation was requested with an invalid offset.");
107 MAP_ERROR(CONNECT_READ_NOT_PERMITTED, NetworkError,
108 "GATT read operation is not permitted.");
109 MAP_ERROR(CONNECT_REQUEST_NOT_SUPPORTED, NetworkError,
110 "The given request is not supported.");
111 MAP_ERROR(CONNECT_UNKNOWN_ERROR, NetworkError, 98 MAP_ERROR(CONNECT_UNKNOWN_ERROR, NetworkError,
112 "Unknown error when connecting to the device."); 99 "Unknown error when connecting to the device.");
113 MAP_ERROR(CONNECT_UNKNOWN_FAILURE, NetworkError, 100 MAP_ERROR(CONNECT_UNKNOWN_FAILURE, NetworkError,
114 "Connection failed for unknown reason."); 101 "Connection failed for unknown reason.");
115 MAP_ERROR(CONNECT_UNSUPPORTED_DEVICE, NetworkError, 102 MAP_ERROR(CONNECT_UNSUPPORTED_DEVICE, NetworkError,
116 "Unsupported device."); 103 "Unsupported device.");
117 MAP_ERROR(CONNECT_WRITE_NOT_PERMITTED, NetworkError,
118 "GATT write operation is not permitted.");
119 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, 104 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError,
120 "Bluetooth Device is no longer in range."); 105 "Bluetooth Device is no longer in range.");
121 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired."); 106 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired.");
122 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, 107 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError,
123 "GATT operation already in progress."); 108 "GATT operation already in progress.");
124 MAP_ERROR(UNTRANSLATED_CONNECT_ERROR_CODE, NetworkError,
125 "Unknown ConnectErrorCode.");
126 109
127 // NotFoundErrors: 110 // NotFoundErrors:
128 MAP_ERROR(WEB_BLUETOOTH_NOT_SUPPORTED, NotFoundError, 111 MAP_ERROR(WEB_BLUETOOTH_NOT_SUPPORTED, NotFoundError,
129 "Web Bluetooth is not supported on this platform. For a list " 112 "Web Bluetooth is not supported on this platform. For a list "
130 "of supported platforms see: https://goo.gl/J6ASzs"); 113 "of supported platforms see: https://goo.gl/J6ASzs");
131 MAP_ERROR(NO_BLUETOOTH_ADAPTER, NotFoundError, 114 MAP_ERROR(NO_BLUETOOTH_ADAPTER, NotFoundError,
132 "Bluetooth adapter not available."); 115 "Bluetooth adapter not available.");
133 MAP_ERROR(CHOSEN_DEVICE_VANISHED, NotFoundError, 116 MAP_ERROR(CHOSEN_DEVICE_VANISHED, NotFoundError,
134 "User selected a device that doesn't exist anymore."); 117 "User selected a device that doesn't exist anymore.");
135 MAP_ERROR(CHOOSER_CANCELLED, NotFoundError, 118 MAP_ERROR(CHOOSER_CANCELLED, NotFoundError,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 "requestDevice() called from cross-origin iframe."); 174 "requestDevice() called from cross-origin iframe.");
192 175
193 #undef MAP_ERROR 176 #undef MAP_ERROR
194 } 177 }
195 178
196 NOTREACHED(); 179 NOTREACHED();
197 return DOMException::create(UnknownError); 180 return DOMException::create(UnknownError);
198 } 181 }
199 182
200 } // namespace blink 183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698