3 ms·
Trying to minimize the error message as the implementor is a dangerous game because nobody else will have as much context as you. Rust error messages are widely
by Tarean 6y ago
Trying to minimize the error message as the implementor is a dangerous game because nobody else will have as much context as you.
Rust error messages are widely lauded because they give context and help, not because they minimize character count.
My priorities for errors are:
- enough context to find the error and possibly further information
- consistent formatting so users can learn pattern recognition. Powershell is much better at this than Unix tools because the shell displays errors
- error message should fit on one screen and little but the relevant error should be printed after an interactive command
Terseness is mostly relevant for non-interactive use such as log files that need to be read quickly.
- lifthrasiir 6y agoWhile I'm not disagreeing, there's more: if you are likely to see the error many times it should be short (compare with the variable name length). I think "command not found" is by itself a pretty good message because it is clear and so frequent that deserves a short message. But if it occurs in the middle of a shell script I would like to have the offending line as well.
- alpaca128 6y agoMeaningful, detailed error messages are one of the core features of a compiler as the developer needs as much info they can get to find and fix the problem. But when you call e.g. the mentioned `cat` command as a user you don't care in what function it encountered an error and the context leading up to it, you just want to know what went wrong, unless maybe you're about to file a bug report. Also the Rust compiler's output quality isn't due to the length of the output, it's just formatted very well and has often very useful hints thanks to the compiler's insight into types and ownership. In the world of NodeJS, TypeScript etc. I've seen a fair share of verbose error messages, mostly consisting of worthless but colorfully formatted information that only makes it harder to find the actually useful part.