[d8] Throw Error objects instead of strings by default
Change-Id: I3eaa9c7e80bea7748dc28ec4ff09fecbdd7a434d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639767 Reviewed-by: Victor Gomes <victorgomes@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#72220}
This commit is contained in:
parent
e6cfe142c9
commit
cb020c8e21
@ -334,8 +334,8 @@ v8::Platform* g_default_platform;
|
||||
std::unique_ptr<v8::Platform> g_platform;
|
||||
|
||||
static Local<Value> Throw(Isolate* isolate, const char* message) {
|
||||
return isolate->ThrowException(
|
||||
String::NewFromUtf8(isolate, message).ToLocalChecked());
|
||||
return isolate->ThrowException(v8::Exception::Error(
|
||||
String::NewFromUtf8(isolate, message).ToLocalChecked()));
|
||||
}
|
||||
|
||||
static MaybeLocal<Value> TryGetValue(v8::Isolate* isolate,
|
||||
|
@ -9,5 +9,5 @@ import('no-such-file').catch(e => error1 = e);
|
||||
import('no-such-file').catch(e => error2 = e);
|
||||
%PerformMicrotaskCheckpoint();
|
||||
|
||||
assertEquals(error1, error2);
|
||||
assertEquals(typeof error1, "string");
|
||||
assertEquals(error1.message, error2.message);
|
||||
assertEquals(typeof error1.message, "string");
|
||||
|
@ -48,7 +48,7 @@ async function test3() {
|
||||
let x = await import('nonexistent-file.mjs');
|
||||
%AbortJS('failure: should be unreachable');
|
||||
} catch(e) {
|
||||
assertTrue(e.startsWith('d8: Error reading'));
|
||||
assertTrue(e.message.startsWith('d8: Error reading'));
|
||||
ran = true;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ async function test3() {
|
||||
let x = await import('nonexistent-file.mjs');
|
||||
%AbortJS('failure: should be unreachable');
|
||||
} catch(e) {
|
||||
assertTrue(e.startsWith('d8: Error reading'));
|
||||
assertTrue(e.message.startsWith('d8: Error reading'));
|
||||
ran = true;
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ var promise = __f_0();
|
||||
promise.then(assertUnreachable,
|
||||
err => { done = true; error = err });
|
||||
%PerformMicrotaskCheckpoint();
|
||||
assertTrue(error.startsWith('d8: Error reading'));
|
||||
assertTrue(error.message.startsWith('d8: Error reading'));
|
||||
assertTrue(done);
|
||||
|
Loading…
Reference in New Issue
Block a user