Merge pull request #781 from lightpanda-io/null-scriptname

handle null scriptname in stacktrace
This commit is contained in:
Karl Seguin
2025-06-16 11:52:40 +08:00
committed by GitHub
3 changed files with 9 additions and 5 deletions

View File

@@ -13,8 +13,8 @@
.hash = "tigerbeetle_io-0.0.0-ViLgxpyRBAB5BMfIcj3KMXfbJzwARs9uSl8aRy2OXULd",
},
.v8 = .{
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/faab44996a5cb74c71592bda404208fde4bf2e63.tar.gz",
.hash = "v8-0.0.0-xddH6xWyAwB_NFICSO4Q3O-c7gDKnYiwky5FhQzTZMIr",
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/1d25fcf3ced688adca3c7a95a138771e4ebba692.tar.gz",
.hash = "v8-0.0.0-xddH61eyAwDICIkLAkfQcxsX4TMCKY80QiSUgNBQqx-u",
},
//.v8 = .{ .path = "../zig-v8-fork" },
//.tigerbeetle_io = .{ .path = "../tigerbeetle-io" },

View File

@@ -48,7 +48,7 @@ pub const Interfaces = .{
// allocatorate data, I should be able to retrieve the scheme + the following `:`
// from rawuri.
//
// 2. The other way would bu to copy the `std.Uri` code to ahve a dedicated
// 2. The other way would be to copy the `std.Uri` code to have a dedicated
// parser including the characters we want for the web API.
pub const URL = struct {
uri: std.Uri,

View File

@@ -3214,8 +3214,12 @@ fn stackForLogs(arena: Allocator, isolate: v8.Isolate) !?[]const u8 {
for (0..frame_count) |i| {
const frame = stack_trace.getFrame(isolate, @intCast(i));
const script = try jsStringToZig(arena, frame.getScriptName(), isolate);
try writer.print("{s}{s}:{d}", .{ separator, script, frame.getLineNumber() });
if (frame.getScriptName()) |name| {
const script = try jsStringToZig(arena, name, isolate);
try writer.print("{s}{s}:{d}", .{ separator, script, frame.getLineNumber() });
} else {
try writer.print("{s}<anonymous>:{d}", .{ separator, frame.getLineNumber() });
}
}
return buf.items;
}