Better Error for Stale Session

Rather than giving a generic 500 error, tell the user to reload the page.
This commit is contained in:
Jacques Distler 2007-12-30 10:41:19 -06:00
parent a2c7705de5
commit 0c16ab4e6f

View file

@ -115,13 +115,17 @@ class ApplicationController < ActionController::Base
end end
def rescue_action_in_public(exception) def rescue_action_in_public(exception)
render :status => 500, :text => <<-EOL if exception.instance_of?(CGI::Session::CookieStore::TamperedWithCookie)
<html xmlns="http://www.w3.org/1999/xhtml"><body> render :text => 'Stale session. Please reload the page.', :status =>500, :layout => 'error'
<h2>Internal Error</h2> else
<p>An application error occurred while processing your request.</p> render :status => 500, :text => <<-EOL
<!-- \n#{exception}\n#{exception.backtrace.join("\n")}\n --> <html xmlns="http://www.w3.org/1999/xhtml"><body>
</body></html> <h2>Internal Error</h2>
EOL <p>An application error occurred while processing your request.</p>
<!-- \n#{exception}\n#{exception.backtrace.join("\n")}\n -->
</body></html>
EOL
end
end end
def return_to_last_remembered def return_to_last_remembered