logoalt Hacker News

tayo42today at 12:31 AM2 repliesview on HN

How is a stack trace with line numbers and a message for the exception it self not enough information for why an exception was thrown?

The exceptions from something like open are always pretty clear. Like, the files not found, and here is the exact line of code and the entire call stack. what else do you want to know to debug?


Replies

9rxtoday at 12:44 AM

It's enough information if you are happy to have a fragile API, but why would you purposefully make life difficult not only for yourself, but the developers who have their code break every time you decide to change something that should only be an internal implementation detail?

Look, if you're just writing a script that doesn't care about failure — where when something goes wrong you can exit and let the end user deal with whatever the fault was, you don't have to worry about this. But Go is quite explicitly intended to be a systems language, not a scripting language. That shit doesn't fly in systems.

While you can, of course, write systems in Python, it is intended to be a scripting language, so I understand where you are coming from thinking in terms of scripts, but it doesn't exactly fit the rest of the discussion that is about systems.

show 1 reply
arccytoday at 1:37 AM

like why did the program even choose to open this file? a stack trace is useless if your code is even a little bit generic