读书人

rails错误(异常)处理

发布时间: 2012-11-19 10:18:51 作者: rapoo

rails异常(错误)处理

方法1:http://www.uedidea.com/rails%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86.html

?

?

?



?? hlee 在文中还提到可以这样做:

?

方法3:rescue_action_in_public



参考:http://202.199.224.30/post/article/7

    DEFAULT_RESCUE_RESPONSE = :internal_server_error      DEFAULT_RESCUE_RESPONSES = {        'ActionController::RoutingError'             => :not_found,        'ActionController::UnknownAction'            => :not_found,        'ActiveRecord::RecordNotFound'               => :not_found,        'ActiveRecord::StaleObjectError'             => :conflict,        'ActiveRecord::RecordInvalid'                => :unprocessable_entity,        'ActiveRecord::RecordNotSaved'               => :unprocessable_entity,        'ActionController::MethodNotAllowed'         => :method_not_allowed,        'ActionController::NotImplemented'           => :not_implemented,        'ActionController::InvalidAuthenticityToken' => :unprocessable_entity      }            DEFAULT_RESCUE_TEMPLATE = 'diagnostics'      DEFAULT_RESCUE_TEMPLATES = {        'ActionView::MissingTemplate'       => 'missing_template',        'ActionController::RoutingError'    => 'routing_error',        'ActionController::UnknownAction'   => 'unknown_action',        'ActionView::TemplateError'         => 'template_error'      }  
?




又看了这篇贴子中的讨论:http://www.iteye.com/topic/708334
rails的错误处理还需要再研究。

?

读书人网 >网络基础

热点推荐