This is less a full fledged idea and more of an invitation to get thoughts and feedback.
Is there a widely established and uniform (or semi-uniform) style guide for error message handling?
In PEP8 currently, it mentions exceptions briefly, stating about exception hierarchies:
"Aim to answer the question “What went wrong?” programmatically, rather than only stating that “A problem occurred…”
But PEP8 doesn’t state best practices for logging errors, such as:
- when to include a repr in an error message (if at all)
- what to include in the error message
- whether or not to include a traceback, and if so, how
- what form a recovery message for an error should take (e.g. something along the lines of NNGroup’s Error Message Guidelines for user experience design)
I think a PEP that spells out the above could go a long way in helping new coders write better code that’s easier to diagnose and fix when errors arise. But I also acquiesce that I don’t know all the answers or best practices and I’d like to hear folks’ thoughts on this.