Ruby best practice re handling system exceptions/application

Hi all,

What is Ruby best practice re handling system exceptions/application
errors/audit events? (mostly for usage with Rails, but also for general
Ruby apps). How do Ruby developers normally handle the following
categories
of event?:

a) Uncaught exceptions (i.e. bubble up to top)

  • Usage: System failure / developer can’t do anything
  • Approach: Let exception bubble to the top
  • Logging: How? Rails: Ensure rails exception framework will issue
    a “logger.error” message to the logs?
  • Alerting: Alert (SMS/Email) based on trigger from an uncaught
    exception. Rails: Use of “exception_notification” plugin perhaps.

b) Trapped exceptions (i.e. handle explicitly)

  • Usage: Understood application error (not system error)
    / Developer can offer value add
  • Approach: Catch and handle hence no exception flows up?
  • Logging: Rails: Issue a “logger.error” line
  • Alerting: Hook into the application’s exception framework.
    Rails: How to hook into “exception_notification” plugin?

c) Application Specific Audit

  • Usage: For application specific event (e.g. sale
    has occurred) and want an email alert and a log entry .
  • Logging: Via use of application logging facility.
    Rails: Use of “logger.info” system
  • Alerting: Use of application alerting system.
    Rails: Use of “exception_notification” plugin
    somehow?

Any comments / ideas / best practice suggestions would be appreciated.

Cheers
Greg

On Mar 21, 2007, at 18:24, Greg H. wrote:

  • Usage: System failure / developer can’t do anything
  • Approach: Let exception bubble to the top
  • Logging: How? Rails: Ensure rails exception framework will issue
    a “logger.error” message to the logs?
  • Alerting: Alert (SMS/Email) based on trigger from an uncaught
    exception. Rails: Use of “exception_notification” plugin perhaps.

I send emails for uncaught exceptions in Rails. It gets me to fix them.

All other exceptions I handle appropriately.

Appropriately means various things depending upon the exception.