[Ovirt-devel] [PATCH server] Taskomatic wasn't catching exceptions extending Exception or errors raised while saving the task.

Scott Seago
Tue, 21 Apr 2009 14:01:05 -0000

Signed-off-by: Scott Seago <sseago at redhat.com>
---
 src/task-omatic/taskomatic.rb |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/task-omatic/taskomatic.rb b/src/task-omatic/taskomatic.rb
index f852c32..850701f 100755
--- a/src/task-omatic/taskomatic.rb
+++ b/src/task-omatic/taskomatic.rb
@@ -859,7 +859,7 @@ class TaskOmatic
             state = Task::STATE_FAILED
             task.message = "Unknown task type"
           end
-        rescue => ex
+        rescue Exception => ex
           @logger.error "Task action processing failed: #{ex.class}:
#{ex.message}"
           @logger.error ex.backtrace
           state = Task::STATE_FAILED
@@ -868,7 +868,12 @@ class TaskOmatic

         task.state = state
         task.time_ended = Time.now
-        task.save!
+        begin
+          task.save!
+        rescue Exception => ex
+          @logger.error "Error saving task state for task #{task.id}:
#{ex.class}: #{ex.message}"
+          @logger.error ex.backtrace
+        end
         @logger.info "done"
       end
       # FIXME: here, we clean up "orphaned" tasks.  These are tasks
--
1.6.0.6