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.
Found an answer although I still don’t really understand it.
http://dev.rubyonrails.org/ticket/6863
Jonathan R. 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.
On 10 Mar 2008, at 21:15, Jonathan R. 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