improve zig panic clarity

This commit is contained in:
Brendan Hansknecht 2024-07-24 14:06:07 -07:00
parent eef5b1a349
commit 2bbb17c1de
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -394,11 +394,13 @@ fn exportUtilsFn(comptime func: anytype, comptime func_name: []const u8) void {
// Custom panic function, as builtin Zig version errors during LLVM verification
pub fn panic(message: []const u8, stacktrace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
if (builtin.is_test) {
std.debug.print("{s}: {?}", .{ message, stacktrace });
if (builtin.target.cpu.arch != .wasm32) {
std.debug.print("\nSomehow in unreachable zig panic!\nThis is a roc standard libarry bug\n{s}: {?}", .{ message, stacktrace });
std.process.abort();
} else {
// Can't call abort or print from wasm. Just leave it as unreachable.
unreachable;
}
unreachable;
}
// Run all tests in imported modules