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

function pr(x) {
    return new Promise(resolve => {resolve(x)});
}

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

    throw a + 1;

    const b = await pr(x + 10);

    return a + b;
}

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