← Back to context

Comment by kristoff_it

3 days ago

That is indeed more or less what you commonly do when you need something more than just error codes.

As an example: https://github.com/kristoff-it/ziggy/blob/852053b09a5f8f5b79...

The part about mapping every error kind to different error code in Zig is debatable. It might be useful in some cases maybe (I don't have the confidence to fully exclude it), but at the very least in my experience I never ever needed that.

In general if you have the (IMO sensible) approach of taking as few dependencies as possible and not treating them like a black box, then for any error you can simply look at the call stack and figure out the problem from reading the code during development.

Outside of that, error codes are useful for debugging code that is running on other people's machines (i.e. in production) for and for reporting reasons.