tests/auto/qml/ecmascripttests/test262/test/language/expressions/await/await-throws-rejections.js
raw| 1 | // Copyright 2016 Microsoft, Inc. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | author: Brian Terlson <[email protected]> |
| 6 | esid: pending |
| 7 | description: > |
| 8 | Await throws errors from rejected promises |
| 9 | ---*/ |
| 10 | |
| 11 | async function foo() { |
| 12 | var err = {}; |
| 13 | var caught = false; |
| 14 | try { |
| 15 | await Promise.reject(err); |
| 16 | } catch(e) { |
| 17 | caught = true; |
| 18 | assert.sameValue(e, err); |
| 19 | } |
| 20 | |
| 21 | assert(caught); |
| 22 | } |
| 23 |