mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
Don't reset exception handle after calling ErrWithV8Handle::get_handle() (#4214)
This commit is contained in:
parent
83d902a780
commit
3fcbf8789e
2 changed files with 7 additions and 12 deletions
|
@ -315,19 +315,14 @@ impl EsIsolate {
|
|||
let mut resolver = resolver_handle.get(scope).unwrap();
|
||||
resolver_handle.reset(scope);
|
||||
|
||||
let exception = match ErrBox::downcast::<ErrWithV8Handle>(err) {
|
||||
Ok(mut err) => {
|
||||
let handle = err.get_handle();
|
||||
let exception = handle.get(scope).unwrap();
|
||||
handle.reset(scope);
|
||||
exception
|
||||
}
|
||||
Err(err) => {
|
||||
let exception = err
|
||||
.downcast_ref::<ErrWithV8Handle>()
|
||||
.and_then(|err| err.get_handle().get(scope))
|
||||
.unwrap_or_else(|| {
|
||||
let message = err.to_string();
|
||||
let message = v8::String::new(scope, &message).unwrap();
|
||||
v8::Exception::type_error(scope, message)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
resolver.reject(context, exception).unwrap();
|
||||
scope.isolate().run_microtasks();
|
||||
|
|
|
@ -1164,8 +1164,8 @@ impl ErrWithV8Handle {
|
|||
Self { err, handle }
|
||||
}
|
||||
|
||||
pub fn get_handle(&mut self) -> &mut v8::Global<v8::Value> {
|
||||
&mut self.handle
|
||||
pub fn get_handle(&self) -> &v8::Global<v8::Value> {
|
||||
&self.handle
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue