From b10131ee5285c6d5598159a3ab108d8a84afc6db Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 5 Aug 2024 21:36:31 +0200 Subject: [PATCH] feat: panic with stacktrace on OutOfMemory errors when stack_trace_on_errors is set --- src/thespian.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/thespian.zig b/src/thespian.zig index 861a312..22255ac 100644 --- a/src/thespian.zig +++ b/src/thespian.zig @@ -252,6 +252,7 @@ pub fn exit_fmt(comptime fmt: anytype, args: anytype) result { } pub fn exit_error(e: anyerror, stack_trace: ?*std.builtin.StackTrace) error{Exit} { + if (stack_trace_on_errors and e == error.OutOfMemory) std.debug.panicExtra(stack_trace, null, "{any}", .{e}); return switch (e) { error.Exit => error.Exit, else => set_error_msg(exit_message(e, stack_trace)),