Fix issues around custom templates and inheriting default templates.

Now you can just override the formats or variables you want for the
custom error handling. If you haven't specified an override, then error
handling will fallback to the defaults.

Also add error better handling if something goes awry in the handlebars
template processing for the error templates (errors encountered while
generating error messages is sad).

This also brings a switch from underscore to lodash. This turned out to
not be strictly necessary for these specific changes, but the code
changes got tied up with this, and I had been wanting to switch anyway,
so lodash it is!