@akavel great post and beautiful blog!
I just wanted to add that personally, I've explained this as:
> Error messages should contain the word 'because'.
> Like 'can't do x because y happened'
IMO the important part you are commenting on your blog is that we need both the x and y information," because" is just an intuitive heuristic to remind about that
@akavel I was mostly coming from a usability angle w/ "because". Yes you are right the colon that golang puts in by default takes its place.
To give a more concrete example, instead of the error being "can't display user page" or "file '/opt/myapp/templates/user.tmpl' not found", ideally it would be
"can't display user page because file ''/opt/myapp/templates/user.tmpl' not found"
I suppose
"can't display user page: file ''/opt/myapp/templates/user.tmpl' not found"
is fine too but I prefer the former, I think in some situations it makes it more clear / easier to read. Especially for users who might not be experienced with golang and stuff
@forestjohnson Hmmm, interesting, thank you! So, the "because" would be implemented through the ": " part in Go error messages, and by e.g. nested exceptions via a "cause" field in Java and some other langs, am I getting it right? 🤔 Also I guess stacktraces also encode some of this "because", yes? 🤔 On the other hand, I am not completely sure "because" makes me think of error context; like "because file name was not-found.txt" sounds odd to me; any thoughts? Also, thank you for the good words! ☺️