aboutsummaryrefslogtreecommitdiff
path: root/test/js/async_throw.t.js
blob: b872080c7c5c89bd2594949203460fb6521ce105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*---
includes: []
flags: [async]
---*/

function pr(x) {
    return new Promise(resolve => {resolve(x)}).then(v => {throw v});
}

async function add(x) {
    const a = await pr(x);
    const b = await pr(x);

    return a + b;
}

add(50)
.then(v => $DONOTEVALUATE())
.catch(v => {
    assert.sameValue(v, 50);
})
.then($DONE, $DONE);