24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/ixtlan/errors/rescue_module.rb', line 24
def self.included(controller)
if defined? ::Ixtlan::ModifiedBy
controller.rescue_from ::Ixtlan::ModifiedBy::StaleResourceError, :with => :stale_resource
end
if defined? ::Ixtlan::Optimistic
controller.rescue_from ::Ixtlan::Optimistic::ObjectStaleException, :with => :stale_resource
end
if defined? ::Ixtlan::Guard
controller.rescue_from ::Ixtlan::Guard::GuardException, :with => :page_not_found
controller.rescue_from ::Ixtlan::Guard::PermissionDenied, :with => :page_not_found
end
if defined? ::DataMapper
controller.rescue_from ::DataMapper::ObjectNotFoundError, :with => :page_not_found
end
if defined? ::ActiveRecord
controller.rescue_from ::ActiveRecord::RecordNotFound, :with => :page_not_found
end
controller.rescue_from ::ActionController::RoutingError, :with => :page_not_found
if defined? ::AbstractController::ActionNotFound
controller.rescue_from ::AbstractController::ActionNotFound, :with => :page_not_found
else
controller.rescue_from ::ActionController::UnknownAction, :with => :page_not_found
end
controller.rescue_from ::ActionController::MethodNotAllowed, :with => :page_not_found
controller.rescue_from ::ActionController::NotImplemented, :with => :page_not_found
controller.rescue_from ::ActionController::InvalidAuthenticityToken, :with => :stale_resource
unless Rails.application.config.consider_all_requests_local
controller.rescue_from ::ActionView::MissingTemplate, :with => :internal_server_error
controller.rescue_from ::ActionView::TemplateError, :with => :internal_server_error
controller.rescue_from ::Exception, :with => :internal_server_error
end
end
|