+38 050 385-94-89

beatom.net

 
 
Why Errors Are Your Best Friend

Sometimes, as developers, we believe errors are negative reflections on our applications. But are they really so? In today’s post, I show you how they’re anything but negative, they’re actually very very positive, when interpreted correctly.

They can be a source of never ending knowledge about your application, helping you, guiding you on the way to forever making it better. They can tell you so much about your application, such as:

  • How people are using the site (which you didn’t allow for)
  • What different crawlers are expecting
  • Odd and curious requests that people are making of it
  • Potentially what people would like or expect to see

Above and beyond this, they’re also a way to grow your development education – as you’ll see.

In an application that I’ve written, based on Zend Framework 1, I have a pretty fair amount of logging going on, using Zend Log. To save me having to always check it, I configured an email writer that let’s me know about different event priorities via email. Below is a sample of a recent one (formatted for readability):

2012-12-03T03:52:30-08:00 CRIT (2): Error: Application error.
Reason: exception ‘Zend_Acl_Exception’ with message
‘Resource ‘default:humans.txt’ not found’ in
/srv/www/library/Zend/Acl.php:365

As you can see, something has requested humans.txt, which the application doesn’t support. At first, I was a bit bemused when I read this and wondered why anyone would request such a file, until I did a bit of googling on the subject and came across this site that explains what they are. It turns out, a humans.txt file is:

…an initiative for knowing the people behind a website. It’s a TXT file that contains information about the different people who have contributed to building the website.

As I read more of the site I became increasingly intrigued and actually rather hooked. Though I don’t really need it, it seemed like a good idea to add one. Ok, I am, like a lot of us geeks, a little bit of a fanboy of all things new and shiny at heart. Plus, it should take no more than a few minutes to create and doesn’t detract from the site as a whole.

So here’s what I came up with. Short, sweet and straight to the point:

/* TEAM */
Chef: Matthew Setter
Contact: matthew [at] maltblue.com
Twitter: @settermjd
From:Brisbane, Australia

UI developer: Scott McKenzie
Twitter: @zerohourandco
From:Brisbane, Australia

/* THANKS */
Inspiration: Jon Lebensold
Contact: john [at] lebensold.net

Inspiration: Ryan Bates
Twitter: @rbates

Hosting: cloudControl
Contact: hp [at] cloudcontrol.com

/* SITE */
Language:English
Doctype:HTML5
IDE: Sublime Text

I’ve said that I’m the man behind the site, given a plug to the awesome design company that made the UI and some special thanks to the people that inspired and host the site, with a little bit of information about it.

Without having seen this log message, I never would have even heard of humans.txt let alone known what it was. Thanks to the error message, I’ve been given a window in to another aspect of modern website design, increased my knowledge, even if only slightly, but overall, learned something new.

If you’re thinking logs aren’t all that helpful – I say you’re wrong. Have a look over the error logs of your application. What gems of information are contained in there. I’m sure that you’ll have ones a lot more intense than this simple example.

To paraphrase the Welsh poet, Dylan Thomas, do not let thy logs go gentle into that good night. Read them, analyse them and use the information that they provide to make your site or application better than before.