This project is archived and is in readonly mode.

#2034 ✓resolved
pedz

Exceptions in views hard to catch

Reported by pedz | February 21st, 2009 @ 02:54 AM | in 3.0.2

I had a ticket open in the old Rails bug system about this along with a patch. That patch no longer works.

I have a couple of questions / concerns.

First, if a template encounters an exception during "compile" time, the original exception is caught and wrapped in a TemplateError exception. Thats fine but if an exception occurs during "run" time, the exception is also caught and also wrapped in a TemplateError. It would be nice if those two wrappers were different.

Second, I set a catch for a particular exception but if that exception happens while in a view, then the view code catches it and wraps it. When it gets to action controller, now my exception handler is not used because it looks like a TemplateError exception.

Third, the second item above would not be too bad if there was a defined way to catch a TemplateError exception (or any exception), examine it, and if I don't want to really catch it, return "false" or something like that from my exception handler and have it be caught by the default handlers. (I guess calling rescue_action_without_handler would work but is that "stable"?)

I would not mind working on a patch for all this but it gets frustrating submitting patches for the same issue over and over again.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages