我目前在Rails 2.3.5上,並且儘量在我的應用程序中嘗試使用rescue_from異常。在rails中有什麼好的最佳實踐來處理異常?
我的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
我也希望能夠趕上上面沒有列出任何異常。有建議的方式,我應該寫我的救援?
感謝