Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/engines/v8/v8.zig
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ pub const TryCatch = struct {

// the caller needs to deinit the string returned
pub fn exception(self: TryCatch, alloc: std.mem.Allocator, env: Env) anyerror!?[]const u8 {
if (env.js_ctx == null) return error.EnvNotStarted;

if (self.inner.getException()) |msg| {
return try valueToUtf8(alloc, msg, env.isolate, env.js_ctx.?);
}
Expand All @@ -461,6 +463,8 @@ pub const TryCatch = struct {

// the caller needs to deinit the string returned
pub fn stack(self: TryCatch, alloc: std.mem.Allocator, env: Env) anyerror!?[]const u8 {
if (env.js_ctx == null) return error.EnvNotStarted;

const stck = self.inner.getStackTrace(env.js_ctx.?);
if (stck) |s| return try valueToUtf8(alloc, s, env.isolate, env.js_ctx.?);
return null;
Expand Down