summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gallery/helpers/task.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php
index 79a7c93b..06568887 100644
--- a/modules/gallery/helpers/task.php
+++ b/modules/gallery/helpers/task.php
@@ -76,9 +76,17 @@ class task_Core {
throw new Exception("@todo MISSING_TASK");
}
- $task->state = "running";
- call_user_func_array($task->callback, array(&$task));
- $task->save();
+ try {
+ $task->state = "running";
+ call_user_func_array($task->callback, array(&$task));
+ $task->save();
+ } catch (Exception $e) {
+ $task->log($e->__toString());
+ $task->state = "error";
+ $task->done = true;
+ $task->status = $e->getMessage();
+ $task->save();
+ }
return $task;
}