summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bindings.rs7
-rw-r--r--core/error.rs2
2 files changed, 5 insertions, 4 deletions
diff --git a/core/bindings.rs b/core/bindings.rs
index 2fc6b5092..08ae1c655 100644
--- a/core/bindings.rs
+++ b/core/bindings.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+use crate::error::is_instance_of_error;
use crate::error::AnyError;
use crate::modules::ModuleMap;
use crate::resolve_url_or_path;
@@ -238,7 +239,7 @@ pub extern "C" fn host_import_module_dynamically_callback(
args: v8::FunctionCallbackArguments,
_rv: v8::ReturnValue| {
let arg = args.get(0);
- if arg.is_native_error() {
+ if is_instance_of_error(scope, arg) {
let message = v8::Exception::create_message(scope, arg);
if message.get_stack_trace(scope).unwrap().get_frame_count() == 0 {
let arg: v8::Local<v8::Object> = arg.try_into().unwrap();
@@ -512,7 +513,7 @@ fn eval_context(
None,
Some(ErrInfo {
thrown: exception.into(),
- is_native_error: exception.is_native_error(),
+ is_native_error: is_instance_of_error(tc_scope, exception),
is_compile_error: true,
}),
);
@@ -529,7 +530,7 @@ fn eval_context(
None,
Some(ErrInfo {
thrown: exception.into(),
- is_native_error: exception.is_native_error(),
+ is_native_error: is_instance_of_error(tc_scope, exception),
is_compile_error: false,
}),
);
diff --git a/core/error.rs b/core/error.rs
index be97a90fb..88cb06887 100644
--- a/core/error.rs
+++ b/core/error.rs
@@ -297,7 +297,7 @@ pub(crate) fn attach_handle_to_error(
/// of `instanceof`. `Value::is_native_error()` also checks for static class
/// inheritance rather than just scanning the prototype chain, which doesn't
/// work with our WebIDL implementation of `DOMException`.
-fn is_instance_of_error<'s>(
+pub(crate) fn is_instance_of_error<'s>(
scope: &mut v8::HandleScope<'s>,
value: v8::Local<v8::Value>,
) -> bool {