Skip to content

Commit 77f33c3

Browse files
author
chris.boulton
committed
Move trigger call for onFailure in to ->fail(), so it can catch PHP errors
1 parent 3245c52 commit 77f33c3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/Resque/Job.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,6 @@ public function perform()
188188
catch(Resque_Job_DontPerform $e) {
189189
return false;
190190
}
191-
// Catch any other exception and raise the onFailure event. Rethrow
192-
// the exception
193-
catch(Exception $e) {
194-
Resque_Event::trigger('onFailure', array(
195-
'exception' => $e,
196-
'job' => $this,
197-
));
198-
throw $e;
199-
}
200191

201192
return true;
202193
}
@@ -206,6 +197,11 @@ public function perform()
206197
*/
207198
public function fail($exception)
208199
{
200+
Resque_Event::trigger('onFailure', array(
201+
'exception' => $exception,
202+
'job' => $this,
203+
));
204+
209205
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
210206
require_once dirname(__FILE__) . '/Failure.php';
211207
Resque_Failure::create(

0 commit comments

Comments
 (0)