Frans
Frans

Reputation: 1448

Rescuing a RoutingError in Rails

So, I followed José Valim's blogpost, adding

config.exceptions_app = self.routes

to my application.rb for routing HTTP errors to my own controller.

Everything works just as it's supposed to, my custom error pages work and such, but it throws an ActionController::RoutingErrorthough, which gets logged as FATAL. Is there anyway to get around that FATALmessage? I've been trying to rescue from the error both in the application controller and in my error controller, but to no avail.

2012-06-27 12:19:33.908 [FATAL] [127.0.0.1] 
ActionController::RoutingError (No route matches [GET] "/3489423u4023ho")

Upvotes: 2

Views: 1471

Answers (1)

Bjoernsen
Bjoernsen

Reputation: 2418

Did you add a route like match "/404", :to => "errors#not_found"?

Are you using the production mode, or the development mode?

You won’t be able to see your custom exceptions in development unless you set config.consider_all_requests_local to false in your config/environments/development.rb. The reason is, if the request is considered local, Rails will always favor to show the debug exceptions page;

Upvotes: 2

Related Questions