Forum: Ruby on Rails Error/exception handling approach???

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D5df9fcd7ef4c3c937435d7d6adeab2a?d=identicon&s=25 Greg Hauptmann (Guest)
on 2007-05-22 13:35
(Received via mailing list)

Does anyone have any examples/advice re implementing an error handling
approach.  In particular the requirements/idea I had regarding passing
exceptions/error's from the model layer back to the controller layer is

* common exception method to be used across all models/controllers

* this method handles (a) logging error to logs for developer later (b)
providing an approach user error message, (c) helping the controller
what to
do next [e.g. is error recoverable, let user try again or not], and (d)
triggers a pager/SMS message for high priority items

* parameters for error method:
  - user facing error message (to be used in a view)
  - developer focused error message
  - stack trace / error detail (e.g. SQL error message, etc) - i.e.
technical detail re root cause hopefully
  - priority (ERROR / CRITICAL) - controller uses to determine whether
stay on same view page (e.g. error) or that
    it is a system error (CRITICAL) so just take user back to home page
afterwards.  This could also be used
    to determine a pager message to the developer should be fired off or

Any comments/suggestions sample code would be appreciated.

This topic is locked and can not be replied to.