News for hackers. Stuff that matters.
Re:Go’ing Insane: Endless Error Handling by ThePhysicist on Tuesday September 14, 2021 @10:36AM (#28525480)
Since Go 1.13 wrapping errors is part of the standard library [1]. You could use the "runtime" package to annotate errors with information about the calling context, but IMHO that's not a good idea. I think stack traces should be reserved for unexpected errors, and that is already well covered by the "panic" mechanism. Potentially expected errors that can be handled or returned to the user should simply provide enough information to know what went wrong without forcing the user to go through the code.

1: https://go.dev/blog/go1.13-errors

There are no comments on this comment yet.