evaluation-body-that-throws-after-await.js (511B)
1 // |reftest| async 2 // Copyright 2016 Microsoft, Inc. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 author: Brian Terlson <brian.terlson@microsoft.com> 7 esid: pending 8 description: > 9 Errors thrown from the async function body reject the returned promise 10 flags: [async] 11 ---*/ 12 13 async function foo() { 14 await Promise.resolve(); 15 throw 1; 16 } 17 18 foo().then(function () { 19 $DONE("Should not be called"); 20 }, function (e) { 21 assert.sameValue(e, 1); 22 $DONE(); 23 });