When your server encounters an error in production mode, it will show a default rails error page and not the stack trace that you see in development mode.
You can add custom static html 500 or 404 error pages by putting them in public/500.html and public/404.html.
If you would like to handle errors differently, you can put the following code in your ApplicationController (This code is untested, but is based on a very similar method in one of my projects):
around_filter :handle_errors
def handle_errors
begin
yield
rescue Exception => e
# Handle the exception however you wish.
end
end
Note that the code above will not handle 404 errors. However, you can specify a default action to handle routes that can not be located by putting the following at the bottom of config/routes.rb:
map.connect '*path', :controller => 'home', :action => 'page_not_found'
Edit:
After doing a bit more research, there is an alternate and likely better way of custom error handling: http://brian.pontarelli.com/2007/01/14/handling-rails-404-and-500-errors/. Essentially the recommendation is to overwrite the rescue_action_in_public
method like below:
def rescue_action_in_public(exception)
render :template => "shared/error", :layout => "standard", :status => "500"
end