Skip to content

Commit

Permalink
Catch errors on PHP7
Browse files Browse the repository at this point in the history
Compatible PHP 5/7 *Errors
  • Loading branch information
markitosgv authored Mar 16, 2017
1 parent 808097f commit 4e7709e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions WorkerSingle.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ public function perform(\Resque_Job $job)
\Resque_Event::trigger('afterFork', $job);
$job->perform();
}
catch (\Error $e)
{
$this->logger->log(LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e));
$job->fail($e);
return;
}
catch(\Exception $e) {
$this->logger->log(LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e));
$job->fail($e);
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"require": {
"symfony/framework-bundle": ">=2.0",
"chrisboulton/php-resque": "dev-master",
"symfony/polyfill-php70": "^1.3",
"chrisboulton/php-resque-scheduler": "dev-master"
},
"autoload": {
Expand Down

0 comments on commit 4e7709e

Please sign in to comment.