Error controller to handle HTTP errors.

Fixes #257 and #310.
You must also modify the other dispatcher - run.