Error/exception handling approach?


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, © 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.