public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
refactor error catching to application/errors concern [court3nay]
technoweenie (author)
Mon Feb 04 09:05:18 -0800 2008
commit  d0f5c7e8579f3c7c4fe00ec35bcf03925178abba
tree    cd8ea365a4a5b19d4a9ed8c59d0e908aa006316d
parent  7550df7dc176efd39c4c6ef06a6b0a482d81ddf5
...
1
 
 
2
3
4
5
6
...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 
78
79
80
...
84
85
86
87
88
89
90
91
92
93
94
95
96
97
 
98
...
1
2
3
4
 
5
6
7
...
65
66
67
 
 
 
 
 
 
 
 
68
69
 
70
71
72
73
...
77
78
79
 
 
 
 
 
 
 
 
 
 
 
80
81
0
@@ -1,6 +1,7 @@
0
 class ApplicationController < ActionController::Base
0
+ require_dependency 'application/errors'
0
+
0
   include Mephisto::CachingMethods
0
- cattr_accessor :site_count # what is this for? PDI removing
0
   before_filter :set_cache_root
0
   helper_method :site
0
   attr_reader :site
0
@@ -64,17 +65,9 @@ class ApplicationController < ActionController::Base
0
       render :text => site.call_render(@section, template_type, assigns, self), :status => status
0
     end
0
 
0
- def show_error(message = 'An error occurred.', status = :internal_server_error)
0
- render_liquid_template_for(:error, 'message' => message, :status => status)
0
- end
0
-
0
- def show_404
0
- show_error 'Page Not Found', :not_found
0
- end
0
-
0
     def set_cache_root
0
       host = request.domain(request.subdomains.size + (request.subdomains.first == 'www' ? 0 : 1))
0
- @site ||= Site.find_by_host(host) || Site.find(:first, :order => 'id')
0
+ @site ||= Site.find_by_host(host) || Site.find(:first, :order => 'id') || raise(ActiveRecord::RecordNotFound, "You need to create your first site!")
0
       self.class.page_cache_directory = site.page_cache_directory.to_s
0
     end
0
 
0
@@ -84,15 +77,5 @@ class ApplicationController < ActionController::Base
0
       yield
0
       ENV['TZ'] = old_tz
0
     end
0
-
0
- def rescue_action_in_public(exception)
0
- logger.debug "#{exception.class.name}: #{exception.to_s}"
0
- exception.backtrace.each { |t| logger.debug " > #{t}" }
0
- case exception
0
- when ActiveRecord::RecordNotFound, ::ActionController::UnknownController, ::ActionController::UnknownAction
0
- render :file => File.join(RAILS_ROOT, 'public/404.html'), :status => :not_found
0
- else
0
- render :file => File.join(RAILS_ROOT, 'public/500.html'), :status => :internal_server_error
0
- end
0
- end
0
+
0
 end

Comments

    No one has commented yet.