Bugs: Browse | Submit New | Admin

[#7715] Add exception rescue/logging to Worker derived class methods

Date:
2007-01-09 22:41
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Add exception rescue/logging to Worker derived class methods

Detailed description
Currently, I have to wrap the code in my derived worker classes that actually does the desired work in rescue blocks
like this:

    begin
      chart.calculate!
    rescue
      logger.error "ChartWorker error: #{$!} \n #{$!.backtrace.join("\n")}"
      return
    end


This makes the ruby code in the workers not pretty like ruby code should be but it is nearly impossible to debug the
workers without these blocks. In my opinion, it is the responsibility of the Worker base class to catch all exceptions
not handled by derived class methods and log them with the date, derived class name, exception and backtrace. It should
probably delete the worker as well because there can be no reasonable expectation that the worker would continue to
do anything useful after it has failed to handle an exception.


Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item