diff --git a/app/Console/Command/ServerShell.php b/app/Console/Command/ServerShell.php index 45a06ccc0..215404032 100644 --- a/app/Console/Command/ServerShell.php +++ b/app/Console/Command/ServerShell.php @@ -407,12 +407,26 @@ class ServerShell extends AppShell ); $this->Job->save($data); $jobId = $this->Job->id; - $result = $this->Feed->cacheFeedInitiator($user, $jobId, 'all'); - $this->Job->save(array( - 'message' => 'Job done.', - 'progress' => 100, - 'status' => 4 - )); + try { + $result = $this->Feed->cacheFeedInitiator($user, $jobId, 'all'); + } catch (Exception $e) { + CakeLog::error($e->getMessage()); + $result = false; + } + if ($result) { + $this->Job->save(array( + 'message' => 'Job done.', + 'progress' => 100, + 'status' => 4 + )); + } else { + $this->Job->save(array( + 'message' => 'Job failed. See logs for more details.', + 'progress' => 100, + 'status' => 3, + )); + } + $this->Task->id = $task['Task']['id']; $this->Task->saveField('message', 'Job completed at ' . date('d/m/Y - H:i:s')); }