Skip to content

Commit

Permalink
explicitly call the format (html.erb) if errship is triggered by a ro…
Browse files Browse the repository at this point in the history
…ute with a format
  • Loading branch information
fschwahn committed Nov 16, 2011
1 parent 9fbbd59 commit db7bd7c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/errship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
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,
Expand Down

0 comments on commit db7bd7c

Please sign in to comment.