Exception Notification Plugin Question

Hi,

I have two questions re the Exception Notifier plugin (i.e. which you install via “ruby script/plugin install exception_notification”)

Q1 - In it’s current setup (where it uses /public/500.html) is it possible to remove the “Status: 500 Internal Server Error Content-Type: text/html” text which seems to mysteriously get place at the top of the page?

Q2 - What’s the best way to add dynamic text to the error page? Should I change the following section of the plug-in to point to a normal Rails action/rhtml view? But if I do this would this be making the design brittle, i.e. what happens if there is a Rails internal issue itself which could mean it’s not possible for the error action/rhtml view to work?

....................................................................
def render_500
  respond_to do |type|
    type.html { render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error" }

    .
    .
....................................................................

Tks Greg

PS. In fact I think I may have been the scenario for which Exception Notification was targeted at. Would the the below be correct:

[1] Uncaught Exception (i.e. not expected) => Exception Notification handles these / sends email

[2] Caught Exceptions (understood issue - can offer specific user advice) => Use of custom application exception, global handler which can: (a) send email alert, (b) display dynamic text in custom application error view.rhtml. That is concept is you can throw a custom app exception anywhere in a model/controller and not have to worry about adding a handler/view. => QUESTION 1 - Where/how to catch such exception in the one spot and and handle this? Extend Exception Notification plugin?

[3] Complex Business Rules (in Model, but not per field) => Use of Rails Validation framework but via adding validations

[4] Per Field Validations => Use of Rails Validations

Xin,

I’ve ended up doing the following so far, some of which are adjustments to Jamis Buck’some “Exception Notification” plugin. I’m still optimizing this for my own usage as I go. Hope this helps (any ideas/feedback welcome):

Usage: if error_situation_occurs raise Error.new( “Message to User Here - Will be shown on error page”, “Additional message that will go to log file for developers”,

                Logger::ERROR)

end

Features:

  • Separate user & developer messages
  • Do not have to catch such errors back in controller or views as the below-mentioned rails rescue frame work will handle ( i.e. less work, cleaner code)
  • Just need to raise the Error exception which then triggers/implies/carries out: (a) appropriate email message to user (b) developer specific additional message to logs (c) severity of log entry raised (b) triggers Email/SMS alert based on severity of the error (use of Ruby Logger severity levels)