From 2261eac288a8d5fa21db74227526a71ddcd3be51 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Sat, 17 May 2025 10:57:25 +0200 Subject: [PATCH] expection: fix non-nullable return --- src/browser/page.zig | 7 ++++--- src/runtime/js.zig | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/browser/page.zig b/src/browser/page.zig index e124a8a4..a193d5b0 100644 --- a/src/browser/page.zig +++ b/src/browser/page.zig @@ -642,9 +642,10 @@ pub const Page = struct { switch (try page.scope.module(body, src)) { .value => |v| break :blk v, .exception => |e| { - if (try e.exception(page.arena)) |msg| { - log.info("eval module {s}: {s}", .{ src, msg }); - } + log.info("eval module {s}: {s}", .{ + src, + try e.exception(page.arena), + }); return error.JsErr; }, } diff --git a/src/runtime/js.zig b/src/runtime/js.zig index a2e1fd41..90aeb580 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -1147,7 +1147,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { scope: *const Scope, // the caller needs to deinit the string returned - pub fn exception(self: Exception, allocator: Allocator) !?[]const u8 { + pub fn exception(self: Exception, allocator: Allocator) ![]const u8 { const scope = self.scope; return try valueToString(allocator, self.inner, scope.isolate, scope.context); }