Skip to content

Commit 7185379

Browse files
authored
pass exception (#56148)
1 parent 693bef8 commit 7185379

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Illuminate/Queue/Events/JobAttempted.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class JobAttempted
99
*
1010
* @param string $connectionName The connection name.
1111
* @param \Illuminate\Contracts\Queue\Job $job The job instance.
12-
* @param bool $exceptionOccurred Indicates if an exception occurred while processing the job.
12+
* @param \Throwable|null $exception The exception, if one occurred while processing the job.
1313
*/
1414
public function __construct(
1515
public $connectionName,
1616
public $job,
17-
public $exceptionOccurred = false,
17+
public $exception = null,
1818
) {
1919
}
2020

@@ -25,6 +25,6 @@ public function __construct(
2525
*/
2626
public function successful(): bool
2727
{
28-
return ! $this->job->hasFailed() && ! $this->exceptionOccurred;
28+
return ! $this->job->hasFailed() && is_null($this->exception);
2929
}
3030
}

src/Illuminate/Queue/Worker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,12 @@ public function process($connectionName, $job, WorkerOptions $options)
445445

446446
$this->raiseAfterJobEvent($connectionName, $job);
447447
} catch (Throwable $e) {
448-
$exceptionOccurred = true;
448+
$exceptionOccurred = $e;
449449

450450
$this->handleJobException($connectionName, $job, $options, $e);
451451
} finally {
452452
$this->events->dispatch(new JobAttempted(
453-
$connectionName, $job, $exceptionOccurred ?? false
453+
$connectionName, $job, $exceptionOccurred ?? null
454454
));
455455
}
456456
}

0 commit comments

Comments
 (0)