3 ms·
Posted this because of the other Go error handling post today https://news.ycombinator.com/item?id=44171677 https://news.ycombinator.com/item?id=44171677 I lik
by anttiharju 1y ago
Posted this because of the other Go error handling post today https://news.ycombinator.com/item?id=44171677 https://news.ycombinator.com/item?id=44171677
I like error wrapping. I've worked in codebases where systems had to be debugged by piecing together individual log lines. With error wrapping I can usually see the exact path that lead to the error in one line.
- glenjamin 1y agoIt 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.
- danesparza 1y ago"With error wrapping I can usually see the exact path that lead to the error in one line" This is called a stack trace, and I agree it can be very useful (if the developers were thoughtful about their error handling)
- anttiharju 1y agoI suppose I phrased this poorly. Stack traces are useful indeed. I guess what I like that usually wrapped errors are bit more thoughtful, stack traces can look a bit like "vomit".
- RSHEPP 1y agofrom my experience of late, engineers usually toss stack traces into LLMs and ask what the issue is. good error wrapping, engineers grep for one of the first errors and get to the error code right away. both ways work.
- sfn42 1y agoIf you can't read a stack trace without an LLM you're not an engineer.
- danesparza 1y agoCounterpoint: You might also just be working on an exceptionally bad codebase or with an exceptionally bad runtime (I'm looking at you C/C++ or minified Javascript)
- sfn42 1y agoSure, if the stack trace doesn't have any useful information then it's not useful. In my experience it's usually useful though, it usually tells you both what the problem is and where it is. Sadly a lot of people just don't even try to read them.
- eschatology 1y agoStack trace is much more verbose and shows the symbols leading to the failing function call The error wrapping(s) produce a log line containing a brief message from each layer in the codebase that expected no errors — subtle difference but one is a dump and the other is much more meaningful.