Return response code 500, when rendering error.

Responses by the ShowErrorsMiddleware returned response code 200, which confused my JavaScript code. The attached commit sets a 500 response code, making sure the error can be correctly handled on the client-side.