The way my controllers work is they set up as little as possible and then call the view. It is up to the view to query the database, etc. In my particular application, there are remote queries that can fail which produces an exception which I have put a rescue_from handler for. But since the exception happens in a view, it is wrapped by an ActionView::TemplateError so the rescue_with_handler does not find my exception handler. I just submitted a patch to a ticket I opened a month ago about this. The ticket is #2034. I would argue that wrapping the exception in the first place is ill advised. I can understand wrapping it if it is a compile time error but not if it is an execution time error. But in any case, it seems logical that exceptions during views should be able to be handled just as exceptions during the controller processing. Please review the changes and let me know your thoughts. Thank you, pedz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Apr 14, 2009 at 13:37, pedz <pedzsan@gmail.com> wrote:> But since the exception happens in a view, it is wrapped by an > ActionView::TemplateError so the rescue_with_handler does not find my > exception handler.I support this. My controllers mostly set up paginated collections that are lazy loading (i.e. they hit the database only when you try to iterate them, much like association proxies) because I use fragment caching all over the place. All kinds of errors happen on runtime and wrapping them in a single error class does not only confuse rescue_from, but also Hoptoad and possibly other exception tracker applications that try to group similar errors together. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
+1 -- Yehuda On Wed, Apr 15, 2009 at 7:58 AM, Mislav Marohnić <mislav.marohnic@gmail.com>wrote:> On Tue, Apr 14, 2009 at 13:37, pedz <pedzsan@gmail.com> wrote: > >> But since the exception happens in a view, it is wrapped by an >> ActionView::TemplateError so the rescue_with_handler does not find my >> exception handler. > > > I support this. My controllers mostly set up paginated collections that are > lazy loading (i.e. they hit the database only when you try to iterate them, > much like association proxies) because I use fragment caching all over the > place. > > All kinds of errors happen on runtime and wrapping them in a single error > class does not only confuse rescue_from, but also Hoptoad and possibly other > exception tracker applications that try to group similar errors together. > > > >-- Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---