Add checking for error detail code to exception handler.

In the case where a non-existent forum is requested, the error
code will be 14. Redirect to the root domain name in that case.

We only return HTTP 400 from the API for historical reasons. In
time this will be changed to the more appropriate HTTP 404.