[WIP]Error controller to handle HTTP errors.

Fixes #257 and #310.