Informative Exceptions
Channel: Dominic Widdows
Date: 2020-04-28

This is a song I wrote a few years ago to celebrate an engineer who added a very simple improvement when debugging a distributed system - changing an error message to say what was actually wrong and how to fix it. One tiny little bit of communication in the codebase can save hours of development time, a win for productivity and morale!

Here are the lyrics:

Build a machine, make it gleam with esteem,
Make it cool, make it hot, make it give them a shot!
But one day we know, it could just overflow,
And spill if it’s tripped, if the wrong switch is flipped.
So don’t be too proud, say it clear, say it loud,
And explain just what could go wrong … yeah!

Throw informative exceptions! (no exceptions),
Informative exceptions! (no exceptions),
Write informative exceptions! (no exceptions),
Save your colleagues so much time!

Give more defense than a null reference,
Give a name, give a source, give a path, set a course!
Say what to expect if the fault goes unchecked,
Just a bit more profound than “array out of bounds”
Exceptions are more than just late-breaking bad news
Give us some hope, share your internal values!

Informative exceptions! (no exceptions),
Throw informative exceptions! (no exceptions),
Yeah informative exceptions! (no exceptions),
Give each other a helpful hand!


And we would better find collective wisdom
And feel much less adrift about the system
We’ll build it smarter, groundbreaking and steady,
If we’re less confused about what we built already!

So give your neighbor some words of grace
Not a multithreaded, valueless, bugger off stack trace
And we’ll all find that the world gets better
For us, and for users who type in any letter

Into the box, come on friends, yes it rocks
To just type on a screen and to make a machine
But for to progress to bear fruit and success
It will be squashed around, bear a load, drop one down
Let’s thrill the world with ingenious productions,
That only ever break with clear instructions!

Informative exceptions! (no exceptions),
Informative exceptions! (no exceptions),
Write informative exceptions! (no exceptions),
Shine a light with clear exceptions!
 
Informative exceptions! (no exceptions),
Informative exceptions! (no exceptions),
Write informative exceptions! (no exceptions),
 
Smile at your neighbor,
Give thanks for your good experiences,
And please try to write an informative message
The next time you find you have to throw an exception - woooo!