protected function failedJob(Job $job, \Throwable $exception, bool $internal): void
    {
        if ($this->logger) {
            $context = [
                'name' => $job->getName(),
                'arguments' => $job->getArguments(),
                'message' => $exception->getMessage(),
                'retryable' => !$exception instanceof UnrecoverableJobExceptionInterface,
                'internal' => $internal,
            ];
            if (($p = $exception->getPrevious())) {
                $context['cause'] = $p->getMessage();
            }
            $this->logger->error('Job failed.', $context);
        }
        if ($this->eventDispatcher) {
            $this->eventDispatcher->dispatch(self::JOB_FAILED_EVENT, new FailedJobEvent($job, $exception, $internal));
        }
        if ($this->triggerBatchEvents) {
            $batch = new JobBatch([$job]);
            $batch->next();
            $batch->result($exception);
            $this->finishBatch($batch);
        }
    }
protected function failedJob(Job $job, \Throwable $exception, bool $internal): void
    {
        if ($this->logger) {
            $context = [
                'name' => $job->getName(),
                'arguments' => $job->getArguments(),
                'message' => $exception->getMessage(),
                'retryable' => !$exception instanceof UnrecoverableJobExceptionInterface,
                'internal' => $internal,
            ];
            if (($p = $exception->getPrevious())) {
                $context['cause'] = $p->getMessage();
            }
            $this->logger->error('Job failed.', $context);
        }
        if ($this->eventDispatcher) {
            $this->eventDispatcher->dispatch(self::JOB_FAILED_EVENT, new FailedJobEvent($job, $exception, $internal));
        }
        if ($this->triggerBatchEvents) {
            $batch = new JobBatch([$job]);
            $batch->next();
            $batch->result($exception);
            $this->finishBatch($batch);
        }
    }
protected function failedJob ( Job $ job , \ Throwable $ exception , bool $ internal ) : void { if ( $ this -> logger ) { $ context = [ 'name' => $ job -> getName ( ) , 'arguments' => $ job -> getArguments ( ) , 'message' => $ exception -> getMessage ( ) , 'retryable' => ! $ exception instanceof UnrecoverableJobExceptionInterface , 'internal' => $ internal , ] ; if ( ( $ p = $ exception -> getPrevious ( ) ) ) { $ context [ 'cause' ] = $ p -> getMessage ( ) ; } $ this -> logger -> error ( 'Job failed.' , $ context ) ; } if ( $ this -> eventDispatcher ) { $ this -> eventDispatcher -> dispatch ( self :: JOB_FAILED_EVENT , new FailedJobEvent ( $ job , $ exception , $ internal ) ) ; } if ( $ this -> triggerBatchEvents ) { $ batch = new JobBatch ( [ $ job ] ) ; $ batch -> next ( ) ; $ batch -> result ( $ exception ) ; $ this -> finishBatch ( $ batch ) ; } }
Called when a job failed.
Called when a job failed .