# Ruby best practice re handling system exceptions/application

**URL:** <https://www.ruby-forum.com/t/ruby-best-practice-re-handling-system-exceptions-application/89689>\
**Category:** Ruby\
**Created:** [March 22, 2007, 2:26am UTC](https://www.ruby-forum.com/t/ruby-best-practice-re-handling-system-exceptions-application/89689 "2007-03-22T02:26:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [March 22, 2007, 2:26am UTC](https://www.ruby-forum.com/t/ruby-best-practice-re-handling-system-exceptions-application/89689/1 "2007-03-22T02:26:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [March 27, 2007, 10:15pm UTC](https://www.ruby-forum.com/t/ruby-best-practice-re-handling-system-exceptions-application/89689/2 "2007-03-27T22:15:56Z")

</div>

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.
