A program is (generally) unusable when it goes out of memory or some other lowlevel disaster happens.
Would it make sense to crash these like this below?
What are ways you people act on these?
I am not talking about critical software but things like games etc.
pub const Fatal = enum {
mem,
// other disasters...
};
pub fn wtf(why: Fatal, sender: type, src: std.builtin.SourceLocation) noreturn {
std.debug.panic("fatal error: {s} at {s}:{d} in {s}.{s}()", .{
@tagName(why), src.file, src.line, @typeName(sender), src.fn_name,
});
}
and
const xxx = gpa.alloc(...) catch wtf(mem, @This(), @src());
This would give a quick insight without needing an explicit stacktrace.