File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,21 @@ pub const Env = struct {
331331 };
332332 }
333333
334+ pub fn waitTryCatch (
335+ self : Env ,
336+ alloc : std.mem.Allocator ,
337+ ) anyerror ! JSResult {
338+
339+ // JS try cache
340+ var try_catch : v8.TryCatch = undefined ;
341+ try_catch .init (self .isolate );
342+ defer try_catch .deinit ();
343+
344+ var res = JSResult {};
345+ try self .wait (alloc , try_catch , & res );
346+ return res ;
347+ }
348+
334349 // run a JS script and wait for all callbacks
335350 // try_catch + exec + wait
336351 pub fn run (
Original file line number Diff line number Diff line change @@ -80,6 +80,12 @@ pub fn Env(
8080
8181 // TODO: check exec, wait who have v8 specific params
8282
83+ // waitTryCatch
84+ assertDecl (T , "waitTryCatch" , fn (
85+ self : T ,
86+ alloc : std.mem.Allocator ,
87+ ) anyerror ! JSResult_T );
88+
8389 // execTryCatch() executes script in JS
8490 assertDecl (T , "execTryCatch" , fn (
8591 self : T ,
You can’t perform that action at this time.
0 commit comments