protected def log_error(exception) super(exception) begin ErrorMailer.deliver_snapshot( exception, clean_backtrace(exception), @session.instance_variable_get("@data"), @params, @request.env) rescue => e logger.error(e) end end
Taken from http://wiki.rubyonrails.com/rails/show/HowtoSendEmailWhenRailsThrowsAnException