Skip to content

Commit

Permalink
make the exceptions_to_treat_as_404 method a class method, so that it…
Browse files Browse the repository at this point in the history
… can be appended to easily
  • Loading branch information
jamis committed Aug 2, 2007
1 parent f00c3bf commit 0a43ee9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/exception_notifiable.rb
Expand Up @@ -46,6 +46,14 @@ def exception_data(deliverer=self)
write_inheritable_attribute(:exception_data, deliverer)
end
end

def exceptions_to_treat_as_404
exceptions = [ActiveRecord::RecordNotFound,
ActionController::UnknownController,
ActionController::UnknownAction]
exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
exceptions
end
end

private
Expand All @@ -71,7 +79,7 @@ def render_500

def rescue_action_in_public(exception)
case exception
when *exceptions_to_treat_as_404
when *self.class.exceptions_to_treat_as_404
render_404

else
Expand All @@ -88,12 +96,4 @@ def rescue_action_in_public(exception)
request, data)
end
end

def exceptions_to_treat_as_404
exceptions = [ActiveRecord::RecordNotFound,
ActionController::UnknownController,
ActionController::UnknownAction]
exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
exceptions
end
end

0 comments on commit 0a43ee9

Please sign in to comment.