diff --git a/Gemfile b/Gemfile index 8edad16..ef90283 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ source "http://rubygems.org" group :development do gem 'rake', '>= 0' gem "shoulda", ">= 0" - gem "bundler", "~> 1.0.0" + gem "bundler", "~> 1.0" gem "jeweler", "~> 1.6.0" gem "rcov", ">= 0" end diff --git a/config/locales/en.yml b/config/locales/en.yml index b5e7d06..874f5ff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,6 @@ en: errship: + standard: 'An unknown error has occurred, or you have reached this page by mistake.' '404': title: 'This page does not exist.' description: 'It could have moved, or someone (maybe you!) mistyped the URL.' diff --git a/lib/errship.rb b/lib/errship.rb index 4f03f41..7520c6a 100644 --- a/lib/errship.rb +++ b/lib/errship.rb @@ -23,21 +23,27 @@ def self.included(base) def render_error(exception, errship_scope = false) airbrake_class.send(:notify, exception) if airbrake_class - render :template => '/errship/standard', :locals => { - :status_code => 500, :errship_scope => errship_scope }, :status => (Errship.status_code_success ? 200 : 500) + render :template => '/errship/standard.html.erb', + :layout => 'application', + :locals => { :status_code => 500, :errship_scope => errship_scope }, + :status => (Errship.status_code_success ? 200 : 500) end def render_404_error(exception = nil, errship_scope = false) - render :template => '/errship/standard', :locals => { - :status_code => 404, :errship_scope => errship_scope }, :status => (Errship.status_code_success ? 200 : 404) + render :template => '/errship/standard.html.erb', + :layout => 'application', + :locals => { :status_code => 404, :errship_scope => errship_scope }, + :status => (Errship.status_code_success ? 200 : 404) end # A blank page with just the layout and flash message, which can be redirected to when # all else fails. def errship_standard(errship_scope = false) - flash[:error] ||= 'An unknown error has occurred, or you have reached this page by mistake.' - render :template => '/errship/standard', :locals => { - :status_code => 500, :errship_scope => errship_scope } + flash[:error] ||= I18n.t('errship.standard') + render :template => '/errship/standard.html.erb', + :layout => 'application', + :locals => { :status_code => 500, :errship_scope => errship_scope }, + :status => (Errship.status_code_success ? 200 : 500) end # Set the error flash and attempt to redirect back. If RedirectBackError is raised,