rails/rails — Issue #3323: Controller should be responsible for choice to show exceptions
Author: jeremy
Created: 2011-10-13 21:16:15+00:00
State: open

In Rails 2 we could override `local_request?` on the controller, so you had access to a wealth of info to decide whether to show exceptions like the current account, current user, etc.

In Rails 3 that moved to a middleware and the `local_request?` check moved to the Request itself, which can't see shit.

It'd be great to have a better way to tell `ShowExceptions` to actually show the exception. It's a patchwork of constructor args, rack env vars, and `Request#local?` right now. It shouldn't have to know about any of that except a rack env var, ideally.

Leave it up to the controller to tell it whether to kick in or not.

Example: on every request, set `env['action_dispatch.show_exceptions'] = show_exceptions?` and wrap up the typical local-request checks in a default `#show_exceptions?` that controllers can override and super to.

Targeting 3.2 for a fix. Pull requests welcome!