mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-26 00:59:28 -05:00
Add v8::Isolate::set_capture_stack_trace_for_uncaught_exceptions
This commit is contained in:
parent
0a855e2a64
commit
24ca978b33
3 changed files with 30 additions and 1 deletions
|
@ -54,6 +54,13 @@ void v8__Isolate__Enter(Isolate& isolate) { isolate.Enter(); }
|
||||||
|
|
||||||
void v8__Isolate__Exit(Isolate& isolate) { isolate.Exit(); }
|
void v8__Isolate__Exit(Isolate& isolate) { isolate.Exit(); }
|
||||||
|
|
||||||
|
void v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(Isolate& isolate,
|
||||||
|
bool capture,
|
||||||
|
int frame_limit) {
|
||||||
|
// Note: StackTraceOptions are deprecated so we don't bother to bind to it.
|
||||||
|
isolate.SetCaptureStackTraceForUncaughtExceptions(capture, frame_limit);
|
||||||
|
}
|
||||||
|
|
||||||
Isolate::CreateParams* v8__Isolate__CreateParams__NEW() {
|
Isolate::CreateParams* v8__Isolate__CreateParams__NEW() {
|
||||||
return new Isolate::CreateParams();
|
return new Isolate::CreateParams();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@ extern "C" {
|
||||||
fn v8__Isolate__Dispose(this: &mut CxxIsolate) -> ();
|
fn v8__Isolate__Dispose(this: &mut CxxIsolate) -> ();
|
||||||
fn v8__Isolate__Enter(this: &mut CxxIsolate) -> ();
|
fn v8__Isolate__Enter(this: &mut CxxIsolate) -> ();
|
||||||
fn v8__Isolate__Exit(this: &mut CxxIsolate) -> ();
|
fn v8__Isolate__Exit(this: &mut CxxIsolate) -> ();
|
||||||
|
fn v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(
|
||||||
|
this: &mut CxxIsolate,
|
||||||
|
caputre: bool,
|
||||||
|
frame_limit: i32,
|
||||||
|
);
|
||||||
|
|
||||||
fn v8__Isolate__CreateParams__NEW() -> *mut CreateParams;
|
fn v8__Isolate__CreateParams__NEW() -> *mut CreateParams;
|
||||||
fn v8__Isolate__CreateParams__DELETE(this: &mut CreateParams);
|
fn v8__Isolate__CreateParams__DELETE(this: &mut CreateParams);
|
||||||
|
@ -64,6 +69,22 @@ impl Isolate {
|
||||||
pub fn exit(&mut self) {
|
pub fn exit(&mut self) {
|
||||||
unsafe { v8__Isolate__Exit(self.0) }
|
unsafe { v8__Isolate__Exit(self.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tells V8 to capture current stack trace when uncaught exception occurs
|
||||||
|
/// and report it to the message listeners. The option is off by default.
|
||||||
|
pub fn set_capture_stack_trace_for_uncaught_exceptions(
|
||||||
|
&mut self,
|
||||||
|
capture: bool,
|
||||||
|
frame_limit: i32,
|
||||||
|
) {
|
||||||
|
unsafe {
|
||||||
|
v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(
|
||||||
|
self.0,
|
||||||
|
capture,
|
||||||
|
frame_limit,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Isolate {
|
impl Drop for Isolate {
|
||||||
|
|
|
@ -104,7 +104,8 @@ fn isolate_new() {
|
||||||
params.set_array_buffer_allocator(
|
params.set_array_buffer_allocator(
|
||||||
v8::array_buffer::Allocator::new_default_allocator(),
|
v8::array_buffer::Allocator::new_default_allocator(),
|
||||||
);
|
);
|
||||||
v8::Isolate::new(params);
|
let mut isolate = v8::Isolate::new(params);
|
||||||
|
isolate.set_capture_stack_trace_for_uncaught_exceptions(true, 32);
|
||||||
drop(g);
|
drop(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue