| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/webusb/USBError.h" | 5 #include "modules/webusb/USBError.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 #include "public/platform/modules/webusb/WebUSBError.h" | 9 #include "public/platform/modules/webusb/WebUSBError.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DOMException* USBError::take(ScriptPromiseResolver*, const WebUSBError& webError
) | 13 DOMException* USBError::take(ScriptPromiseResolver*, const WebUSBError& webError
) |
| 14 { | 14 { |
| 15 switch (webError.error) { | 15 switch (webError.error) { |
| 16 case WebUSBError::Error::InvalidState: |
| 17 return DOMException::create(InvalidStateError, webError.message); |
| 16 case WebUSBError::Error::Network: | 18 case WebUSBError::Error::Network: |
| 17 return DOMException::create(NetworkError, webError.message); | 19 return DOMException::create(NetworkError, webError.message); |
| 18 case WebUSBError::Error::NotFound: | 20 case WebUSBError::Error::NotFound: |
| 19 return DOMException::create(NotFoundError, webError.message); | 21 return DOMException::create(NotFoundError, webError.message); |
| 20 case WebUSBError::Error::Security: | 22 case WebUSBError::Error::Security: |
| 21 return DOMException::create(SecurityError, webError.message); | 23 return DOMException::create(SecurityError, webError.message); |
| 22 } | 24 } |
| 23 ASSERT_NOT_REACHED(); | 25 ASSERT_NOT_REACHED(); |
| 24 return DOMException::create(UnknownError); | 26 return DOMException::create(UnknownError); |
| 25 } | 27 } |
| 26 | 28 |
| 27 } // namespace blink | 29 } // namespace blink |
| OLD | NEW |