Illuminate\Queue\Worker::handleJobException PHP Method

handleJobException() protected method

Handle an exception that occurred while the job was running.
protected handleJobException ( string $connectionName, Illuminate\Contracts\Queue\Job $job, WorkerOptions $options, Exception $e ) : void
$connectionName string
$job Illuminate\Contracts\Queue\Job
$options WorkerOptions
$e Exception
return void
    protected function handleJobException($connectionName, $job, WorkerOptions $options, $e)
    {
        // If we catch an exception, we will attempt to release the job back onto the queue
        // so it is not lost entirely. This'll let the job be retried at a later time by
        // another listener (or this same one). We will re-throw this exception after.
        try {
            $this->markJobAsFailedIfHasExceededMaxAttempts($connectionName, $job, (int) $options->maxTries, $e);
            $this->raiseExceptionOccurredJobEvent($connectionName, $job, $e);
        } finally {
            if (!$job->isDeleted()) {
                $job->release($options->delay);
            }
        }
        throw $e;
    }