News for hackers. Stuff that matters.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by dilap on Friday February 19, 2021 @09:56AM (#26193802)
Are you familiar with Zig's error handling? Except for the fact that errors cannot contain payloads, it is, imo, perfect.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by malcolmstill on Friday February 19, 2021 @02:36PM (#26197079)
Of all the absolutely fantastic stuff that Zig gets right, I think my favourite is the error handling.

While it would be cool to get an error payload, I would hope that if that was added to the language, that it doesn't affect the current ergonomics of error handling.

Where I've really needed to get some data back out, I've passed in a pointer to a struct that gets populated.

Re:Where Everything Went Wrong: Error Handling and Error Mes... by jiehong on Friday February 19, 2021 @10:05AM (#26193916)
it has the same issues. You can always discard errors with `catch unreachable` for example.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by defen on Friday February 19, 2021 @11:29AM (#26194785)
If you haven't overridden the default panic handler, and you're in a Debug or ReleaseSafe build you'll still automatically get an error return trace (which is nicer than a stack trace) even if you do `catch unreachable`.
Re:Where Everything Went Wrong: Error Handling and Error Mes... by dilap on Friday February 19, 2021 @10:18AM (#26194059)
True, but it's very explicit, and easy to audit for.