rails/rails — Issue #5150: Rescuing from a rescue_from
Author: Simbul
Created: 2012-02-24 12:35:05+00:00
State: open

Consider this example code:

class ApplicationController < ActionController::Base
class ErrorOne < StandardError; end
class ErrorTwo < StandardError; end

rescue_from ErrorOne do |exception|
raise ErrorTwo
end

rescue_from ErrorTwo do |exception|
# It's ok
end
end

Now suppose you call `raise ApplicationController::ErrorOne` in a controller. You would expect to get into the rescue block for `ErrorOne`, to raise `ErrorTwo` and to get into the rescue block for `ErrorTwo`. The latter never happens, however.

I couldn't find this anywhere in the documentation, so my question is: is this a bug or are `rescue_fom` blocks not supposed to be cascading (i.e. rescuing from one another)?