Guillermo Rauch

Addressable Errors

February 4, 2016 (8y ago)21,428 views

One of the biggest problems with debugging is that error and warning messages are static. The only way for errors to become more useful and evolve is for authors to tweak them and launch a new version of their software.

Unfortunately, some errors are rare and hard to reproduce. You might stumble upon them in a log-file with little context. Deploying new code is costly and time-consuming, and the error is not guaranteed to disappear or become more debuggable.

There’s also a limit to how useful error messages can be by themselves (although it’s a very good idea to constantly improve them.

The usual way to find out more about an error is to Google it to learn from others. But even then, user feedback tends to be scattered in many different places, some of which the project’s authors hardly ever visit.

The solution is simple: attach URLs [1] to all your errors and make them collaborative [2]. GitHub wikis, gists or issues are good candidates for hosting these. Bonus points: shorten them to make live debugging easier.

1. ^ The inspiration for this portion came from seeing in Web Inspector a bunch of times.

2. ^ User comments about best-practices, errors and snippets in combination with permalinks made the PHP manual one of the best resources for newcomers and experts alike.