4 ms·
stack traces are tools for developers, error messages are tools for users users should not see stack traces
by preseinger 3y ago
stack traces are tools for developers, error messages are tools for users
users should not see stack traces
- simiones 3y agoGo error messages are very much also tools for developers, if they are useful in any way.
- preseinger 3y agotrue! of course.
- simiones 3y agoI'm not sure we are in full agreement, my statement was a little ambiguous. I meant to say that, just like stack traces, Go error messages are only helpful to developers, at least 99.9% of the time. More generally, user error messages and dev error messages are just fundamentally at odds, there is no way to have messages that are good for both cases. User error messages should explain what went wrong, and what they can do differently to workaround the issue (if anything). Dev error messages should explain what the code was doing when something went wrong, to help with figuring out what code needs to be modified.
- preseinger 3y agonah go error messages are clear to users without being cryptic
- simiones 3y agoHow is an error like "Error in foo(): error in bar(): reading abcd.xml: file not found" clear to a user? What do foo() and bar() mean to them? What should they do about this missing file? This is just a more simply formatted stack trace, just as useless to an end user. The proper error message for a user in this situation would be something like "Couldn't read required file /home/user/program-name/abcd.xml. Please try to create the file by hand." or "Couldn't read list of entities. Try reinstalling the program or contact support@program-name.com".