We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Writing good error messages

Formal Metadata

Title
Writing good error messages
Title of Series
Number of Parts
132
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Anyone who has ever conducted an elementary programming course, or even answered a question on StackOverflow, will know that reading error messages is a skill that beginners have to learn. It is less widely appreciated that writing good error messages is also a skill that must be learnt. This talk is in two parts. The first covers the commonest error message gaffes: • Insufficiently explicit messages. • Issuing the same message for two different conditions. • Suppressing the stack trace. • Polluting the stack trace. The second part describes a way to ensure usable, actionable error messages, even when the writer of the message is not a professional coder. This was developed for an environment where superusers code up most of the dozens of data validation rules and the accompanying messages, and the application in which Python is embedded suppresses the stack trace.