4a28271fee
If an exception is thrown in instrumented async code, for instance await import('non-existing-module') it should be correctly reported by the hooks that run around this code. Also calling ToLocalChecked() on the hook result is wrong if the hook has thrown an exception. Bug: chromium:865892 Change-Id: I5712376fe4426a3e49223d821e4647150887a258 Reviewed-on: https://chromium-review.googlesource.com/1146561 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#54610}
21 lines
491 B
JavaScript
21 lines
491 B
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --expose-async-hooks
|
|
|
|
let ah = async_hooks.createHook(
|
|
{
|
|
init(asyncId, type) {
|
|
if (type !== 'PROMISE') { return; }
|
|
assertThrows('asyncIds.push(asyncId);');
|
|
}
|
|
});
|
|
ah.enable();
|
|
|
|
async function foo() {
|
|
let x = { toString() { return 'modules-skip-1.js' } };
|
|
assertThrows('await import(x);');
|
|
}
|
|
foo();
|