Jonathan Rochkind
2008-Mar-10 20:45 UTC
constant for ActionController::RoutingError class?
I''m writing a default application-wide rescue_action_in_public. I''d like to do something special when the exception raised was a routing error. Inspecting in debugger, I get: (rdb:1) p exception.class ActionController::RoutingError Yet: (rdb:1) p exception.kind_of?( ActionController::RoutingError ) NameError Exception: uninitialized constant ActionWebService::Dispatcher::ActionController::RoutingError Huh? It''s an ActionController::RoutingError, yet I have no such thing as an ActionController::RoutingError loaded in my runtime? How the heck do I test an exception to see if it''s the kind of exception that reports itself as ActionController::RoutingError? Thanks for any advice. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Rochkind
2008-Mar-10 21:15 UTC
Re: constant for ActionController::RoutingError class?
Found an answer although I still don''t really understand it. http://dev.rubyonrails.org/ticket/6863 Jonathan Rochkind wrote:> I''m writing a default application-wide rescue_action_in_public. > > I''d like to do something special when the exception raised was a routing > error. Inspecting in debugger, I get: > > (rdb:1) p exception.class > ActionController::RoutingError > > > Yet: > > (rdb:1) p exception.kind_of?( ActionController::RoutingError ) > NameError Exception: uninitialized constant > ActionWebService::Dispatcher::ActionController::RoutingError > > > Huh? It''s an ActionController::RoutingError, yet I have no such thing > as an ActionController::RoutingError loaded in my runtime? > > How the heck do I test an exception to see if it''s the kind of exception > that reports itself as ActionController::RoutingError? > > Thanks for any advice.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Mar-11 09:35 UTC
Re: constant for ActionController::RoutingError class?
On 10 Mar 2008, at 21:15, Jonathan Rochkind wrote:> > Found an answer although I still don''t really understand it. > > http://dev.rubyonrails.org/ticket/6863 >What it''s saying is that for some reason when it tries to lookup ActionController::RoutingError it looks in the wrong space (in ActionWebService). You can force it to look at the top level with by prepending :: (ie write ::ActionController::RoutingError instead of ActionController::RoutingError) Fred> > Jonathan Rochkind wrote: >> I''m writing a default application-wide rescue_action_in_public. >> >> I''d like to do something special when the exception raised was a >> routing >> error. Inspecting in debugger, I get: >> >> (rdb:1) p exception.class >> ActionController::RoutingError >> >> >> Yet: >> >> (rdb:1) p exception.kind_of?( ActionController::RoutingError ) >> NameError Exception: uninitialized constant >> ActionWebService::Dispatcher::ActionController::RoutingError >> >> >> Huh? It''s an ActionController::RoutingError, yet I have no such >> thing >> as an ActionController::RoutingError loaded in my runtime? >> >> How the heck do I test an exception to see if it''s the kind of >> exception >> that reports itself as ActionController::RoutingError? >> >> Thanks for any advice. > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---