aboutsummaryrefslogtreecommitdiff
path: root/test/js/async_try_catch.t.js
blob: abb57864f7dcbbea51f9694585e67bb3661237a3 (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
26
27
28
29
30
/*---
includes: [compareArray.js]
flags: [async]
---*/

let stages = [];

async function af() {
    try {
        await new Promise(function(resolve, reject) {
            reject("reject");
        });

        $DONOTEVALUATE();
    }
    catch (v) {
        stages.push(v);
    }
    finally {
        stages.push('finally');
    }

    return "end";
};

af().then(v => {
    stages.push(v);
    assert.compareArray(stages, ['reject', 'finally', 'end']);
})
.then($DONE, $DONE)