OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "modules/webusb/USBError.h" | |
6 | |
7 #include "core/dom/DOMException.h" | |
8 #include "core/dom/ExceptionCode.h" | |
9 #include "public/platform/modules/webusb/WebUSBError.h" | |
10 | |
11 namespace blink { | |
12 | |
13 DOMException* USBError::take(ScriptPromiseResolver*, const WebUSBError& webError
) | |
14 { | |
15 switch (webError.error) { | |
16 case WebUSBError::Error::InvalidState: | |
17 return DOMException::create(InvalidStateError, webError.message); | |
18 case WebUSBError::Error::Network: | |
19 return DOMException::create(NetworkError, webError.message); | |
20 case WebUSBError::Error::NotFound: | |
21 return DOMException::create(NotFoundError, webError.message); | |
22 case WebUSBError::Error::Security: | |
23 return DOMException::create(SecurityError, webError.message); | |
24 } | |
25 ASSERT_NOT_REACHED(); | |
26 return DOMException::create(UnknownError); | |
27 } | |
28 | |
29 } // namespace blink | |
OLD | NEW |