mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-29 15:13:28 +00:00 
			
		
		
		
	Merge pull request #753 from lightpanda-io/console_error_stack_trace
Make stacktraces available in debug via `page.stackTrace()`
This commit is contained in:
		| @@ -66,7 +66,11 @@ pub const Console = struct { | ||||
|         if (values.len == 0) { | ||||
|             return; | ||||
|         } | ||||
|         log.info(.console, "error", .{ .args = try serializeValues(values, page) }); | ||||
|  | ||||
|         log.info(.console, "error", .{ | ||||
|             .args = try serializeValues(values, page), | ||||
|             .stack = page.stackTrace() catch "???", | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     pub fn static_clear() void {} | ||||
|   | ||||
| @@ -671,6 +671,13 @@ pub const Page = struct { | ||||
|         const form = (try Element._closest(element, "form", self)) orelse return null; | ||||
|         return @ptrCast(form); | ||||
|     } | ||||
|  | ||||
|     pub fn stackTrace(self: *Page) !?[]const u8 { | ||||
|         if (comptime builtin.mode == .Debug) { | ||||
|             return self.scope.stackTrace(); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| }; | ||||
|  | ||||
| const DelayedNavigation = struct { | ||||
|   | ||||
| @@ -601,6 +601,10 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { | ||||
|                 return persistent_object.castToObject(); | ||||
|             } | ||||
|  | ||||
|             pub fn stackTrace(self: *const Scope) !?[]const u8 { | ||||
|                 return stackForLogs(self.call_arena, self.isolate); | ||||
|             } | ||||
|  | ||||
|             // Executes the src | ||||
|             pub fn exec(self: *Scope, src: []const u8, name: ?[]const u8) !Value { | ||||
|                 const isolate = self.isolate; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Karl Seguin
					Karl Seguin