Hacker News new | ask | show | jobs
by glenjamin 380 days ago
It would be cool if someone could come up with a way for the runtime system to automatically wrap errors with the calling context.

That way you’d be able to trace the stack of functions that were involved in passing an error back up to the place where it’s actually handled.

2 comments

It's a bold idea cotton
It's possible, stdlib just doesn't do it

https://pkg.go.dev/github.com/pkg/errors

It's sarcasm I believe, they used to call this exceptions. ;)