File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,8 @@ pub const TryCatch = struct {
453453
454454 // the caller needs to deinit the string returned
455455 pub fn exception (self : TryCatch , alloc : std.mem.Allocator , env : Env ) anyerror ! ? []const u8 {
456+ if (env .js_ctx == null ) return error .EnvNotStarted ;
457+
456458 if (self .inner .getException ()) | msg | {
457459 return try valueToUtf8 (alloc , msg , env .isolate , env .js_ctx .? );
458460 }
@@ -461,6 +463,8 @@ pub const TryCatch = struct {
461463
462464 // the caller needs to deinit the string returned
463465 pub fn stack (self : TryCatch , alloc : std.mem.Allocator , env : Env ) anyerror ! ? []const u8 {
466+ if (env .js_ctx == null ) return error .EnvNotStarted ;
467+
464468 const stck = self .inner .getStackTrace (env .js_ctx .? );
465469 if (stck ) | s | return try valueToUtf8 (alloc , s , env .isolate , env .js_ctx .? );
466470 return null ;
You can’t perform that action at this time.
0 commit comments