module ExceptionNotification::HelpfulHashes
Copyright © 2008-2009 Peter H. Boling of 9thBit LLC Released under the MIT license
Constants
- HTTP_STATUS_CODES
TODO: use ActionController::StatusCodes
- SILENT_EXCEPTIONS
Public Instance Methods
codes_for_error_classes()
click to toggle source
# File lib/exception_notification/helpful_hashes.rb, line 32 def codes_for_error_classes #TODO: Format whitespace classes = { # These are standard errors in rails / ruby NameError => "503", TypeError => "503", RuntimeError => "500", ArgumentError => "500", # These are custom error names defined in lib/super_exception_notifier/custom_exception_classes AccessDenied => "403", PageNotFound => "404", InvalidMethod => "405", ResourceGone => "410", CorruptData => "422", NoMethodError => "500", NotImplemented => "501", MethodDisabled => "200" } # Highly dependent on the verison of rails, so we're very protective about these' classes.merge!({ ActionView::TemplateError => "500"}) if defined?(ActionView) && ActionView.const_defined?(:TemplateError) classes.merge!({ ActiveRecord::RecordNotFound => "400" }) if defined?(ActiveRecord) && ActiveRecord.const_defined?(:RecordNotFound) classes.merge!({ ActiveResource::ResourceNotFound => "404" }) if defined?(ActiveResource) && ActiveResource.const_defined?(:ResourceNotFound) if defined?(ActionController) classes.merge!({ ActionController::UnknownController => "404" }) if ActionController.const_defined?(:UnknownController) classes.merge!({ ActionController::MissingTemplate => "404" }) if ActionController.const_defined?(:MissingTemplate) classes.merge!({ ActionController::MethodNotAllowed => "405" }) if ActionController.const_defined?(:MethodNotAllowed) classes.merge!({ ActionController::UnknownAction => "501" }) if ActionController.const_defined?(:UnknownAction) classes.merge!({ ActionController::RoutingError => "404" }) if ActionController.const_defined?(:RoutingError) classes.merge!({ ActionController::InvalidAuthenticityToken => "405" }) if ActionController.const_defined?(:InvalidAuthenticityToken) end end