Code supporting a blog post on automatic error handling in AngularJS