[Mongrel] custom error handling

David Vrensk david at vrensk.com
Mon Sep 4 13:47:04 EDT 2006

On 9/2/06, Kevin Williams <kevwil at gmail.com> wrote:
> Please forgive me if this is a stupid question.

It's not stupid, but it's not mongrel-specific either, so I suggest we take
further discussion off-list.

How can I programatically handle 404s and 500s when using Mongrel?

Check out the exception notifcation plugin:

   script/plugin install exception_notification

If you prefer to do it yourself, look in ActionController::Rescue

# Overwrite to implement public exception handling (for requests answering
false to <tt>local_request?</tt>).
def rescue_action_in_public(exception) #:doc:
  case exception
    when RoutingError, UnknownAction then
      render_text(IO.read(File.join(RAILS_ROOT, 'public', '404.html')), "404
Not Found")
    else render_text "<html><body><h1>Application error

which defines the stuff that is run by default.  And as the comment says:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060904/7e9ffb52/attachment.html 

More information about the Mongrel-users mailing list