mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-26 02:05:14 +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
@ -188,15 +188,6 @@ class Resque_Job
|
|||||||
catch(Resque_Job_DontPerform $e) {
|
catch(Resque_Job_DontPerform $e) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -206,6 +197,11 @@ class Resque_Job
|
|||||||
*/
|
*/
|
||||||
public function fail($exception)
|
public function fail($exception)
|
||||||
{
|
{
|
||||||
|
Resque_Event::trigger('onFailure', array(
|
||||||
|
'exception' => $exception,
|
||||||
|
'job' => $this,
|
||||||
|
));
|
||||||
|
|
||||||
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
|
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
|
||||||
require_once dirname(__FILE__) . '/Failure.php';
|
require_once dirname(__FILE__) . '/Failure.php';
|
||||||
Resque_Failure::create(
|
Resque_Failure::create(
|
||||||
|
Loading…
Reference in New Issue
Block a user