23
Stack Traces are Underrated
(www.karl.berlin)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
You will get the stack at the point of your 'debug.Stack()' call though, not where the error happened.
I'm leaning go, and starting to get used to it, but the error handling is just obnoxious. The constant "if err != nil" makes reading the actual logic so much harder. I'm surprised they haven't come up with some syntactical sugar to make it simpler yet, but these devs seem to see it as some sort of "badge of honor" to suffer.
It will be where the error happened if you conventionally pass your errors to a logger that then prints the stack trace, which is virtually what Python et. al. are doing anyway.
Go is not a language I'm a huge fan of tbh, but this mild inconvenience is not one of the things I would criticise it for. What you're describing w.r.t control flow for errors absolutely is though.