Get the latest tech news
Zig Error Patterns
zig-error-patterns Some patterns I have started to use when writing zig code with unit tests. Introduction Although I try to make good use of the debugger, I am quite used to print-based debugging, especially for unit tests.
Does a fantastic job of avoiding cluttering the code, and providing the precise context necessary when an error actually occurs. This makes it really easy to run the proper binary; however, this isn't enough on its own: the debugger only kicks into action for a breakpoint or panic, but the test runner gracefully handles errors. As a final step, we can hook up the command to run our debugger when the use_debugger flag is set like so:
Or read this on Hacker News