mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Move trigger call for onFailure in to ->fail(), so it can catch PHP errors
This commit is contained in:
parent
3245c523c7
commit
77f33c319b
1 changed files with 5 additions and 9 deletions
|
@ -188,15 +188,6 @@ class Resque_Job
|
|||
catch(Resque_Job_DontPerform $e) {
|
||||
return false;
|
||||
}
|
||||
// Catch any other exception and raise the onFailure event. Rethrow
|
||||
// the exception
|
||||
catch(Exception $e) {
|
||||
Resque_Event::trigger('onFailure', array(
|
||||
'exception' => $e,
|
||||
'job' => $this,
|
||||
));
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -206,6 +197,11 @@ class Resque_Job
|
|||
*/
|
||||
public function fail($exception)
|
||||
{
|
||||
Resque_Event::trigger('onFailure', array(
|
||||
'exception' => $exception,
|
||||
'job' => $this,
|
||||
));
|
||||
|
||||
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
|
||||
require_once dirname(__FILE__) . '/Failure.php';
|
||||
Resque_Failure::create(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue