Error controller to handle HTTP errors.

Fixes #257 and #310.
Why `private`? It seems that in principle, a controller extending this class may want to override the session checking behavior.