Support JSON error responses

This mainly applies to the hosts API, but is simple to do and good
practice for any other requests too.
Rename StaticContentController to ErrorsController

We had been intending to move all non-model pages onto a single
controller, which would cover all error pages and the glossary and
style guide. Because we need error pages to not require authentication,
this no longer makes sense and so errors should be on a controller
of their own. We could still move the glossary and style guide to
a single controller, but that should inherit from ApplicationController
to include authentication.
Factor out error_response on ErrorsController