When exception is thrown and DEBUG is set to false, make sure that the error page/template is shown and not the debug view