rescue_fromと
rescue_from
がException#causeを見るようになったらしい。(参考)
rescue_from SystemCallError, with: ...
rescue_from FooError, with: ...
def index
open('foo/bar') { ... }
rescue Errno::ENOENT
raise FooError
end
こういうのがRails 4と5で…… という気がしたんだがどうだろう?
raise FooError, cause: nil
で回避。だがcause
がexperimental? (参考)
追記
beta3以降で解決済みであった。 (参考)