I recently upgraded a legacy app from Rails 3 to 4 and CMS 1.8 to 1.12. I've noticed that the code in the app's ApplicationController used to rescue from errors is NOT executed:
rescue_from ActionController::RoutingError, ActiveRecord::RecordNotFound do |exception|
render template: '/errors/page_not_found', status: 404
end
Instead, I get an error page in Dev env and blank page in Prod.
Here's the code in CMS that raises RoutingError
def page_not_found
@cms_page = @cms_site.pages.published.find_by_full_path!('/404')
respond_to do |format|
format.html { render_page(404) }
end
rescue ActiveRecord::RecordNotFound
raise ActionController::RoutingError.new("Page Not Found at: \"#{params[:cms_path]}\"")
end
Does it seem like an issue with CMS, perhaps error raised here cannot be caught by ApplicationController again? Or do you think that I should search for a problem in Rails 4.1 ?
Exceptions raised inside exception handlers are not propagated up.
If so, then should we modify page_not_found method to call somehow the global rescue_from (if possible at all)?