【发布时间】:2010-05-27 08:45:17
【问题描述】:
我目前在 Rails 2.3.5 上,我正在尝试在我的应用程序中尽可能简洁地使用 rescue_from 异常。
我的 ApplicationController 救援现在看起来像这样:
rescue_from Acl9::AccessDenied, :with => :access_denied
rescue_from Exceptions::NotPartOfGroup, :with => :not_part_of_group
rescue_from Exceptions::SomethingWentWrong, :with => :something_went_wrong
rescue_from ActiveRecord::RecordNotFound, :with => :something_went_wrong
rescue_from ActionController::UnknownAction, :with => :something_went_wrong
rescue_from ActionController::UnknownController, :with => :something_went_wrong
rescue_from ActionController::RoutingError, :with => :something_went_wrong
我还希望能够捕获上面未列出的任何异常。有没有推荐的方式来写我的救援?
谢谢
【问题讨论】:
标签: ruby-on-rails ruby exception-handling