src/Worker.php
protected function failJob($job, Exception $exception)
    {
        if ($job instanceof JobInterface) {
            $payload = $job->getPayload();
            $queue   = $job->getQueue();
        } else {
            $payload = $job;
            $queue   = isset($job['queue']) ? $job['queue'] : null;
        }

        $id = isset($job['id']) ? $job['id'] : null;

        if ($id) {
            try {
                $status = $this->resque->getStatusFactory()->forId($id);
                $status->update(Status::STATUS_FAILED);
            } catch (JobIdException $e) {
                $this->logger->warning($e);
            }
        } // else no status to update

        $this->resque->getFailureBackend()->receiveFailure(
            $payload,
            $exception,
            $this,
            $queue
        );

        $this->getResque()->getStatistic('failed')->incr();
        $this->getStatistic('failed')->incr();
    }
protected function failJob($job, Exception $exception)
    {
        if ($job instanceof JobInterface) {
            $payload = $job->getPayload();
            $queue   = $job->getQueue();
        } else {
            $payload = $job;
            $queue   = isset($job['queue']) ? $job['queue'] : null;
        }

        $id = isset($job['id']) ? $job['id'] : null;

        if ($id) {
            try {
                $status = $this->resque->getStatusFactory()->forId($id);
                $status->update(Status::STATUS_FAILED);
            } catch (JobIdException $e) {
                $this->logger->warning($e);
            }
        } // else no status to update

        $this->resque->getFailureBackend()->receiveFailure(
            $payload,
            $exception,
            $this,
            $queue
        );

        $this->getResque()->getStatistic('failed')->incr();
        $this->getStatistic('failed')->incr();
    }
protected function failJob ( $ job , Exception $ exception ) { if ( $ job instanceof JobInterface ) { $ payload = $ job -> getPayload ( ) ; $ queue = $ job -> getQueue ( ) ; } else { $ payload = $ job ; $ queue = isset ( $ job [ 'queue' ] ) ? $ job [ 'queue' ] : null ; } $ id = isset ( $ job [ 'id' ] ) ? $ job [ 'id' ] : null ; if ( $ id ) { try { $ status = $ this -> resque -> getStatusFactory ( ) -> forId ( $ id ) ; $ status -> update ( Status :: STATUS_FAILED ) ; } catch ( JobIdException $ e ) { $ this -> logger -> warning ( $ e ) ; } } // else no status to update $ this -> resque -> getFailureBackend ( ) -> receiveFailure ( $ payload , $ exception , $ this , $ queue ) ; $ this -> getResque ( ) -> getStatistic ( 'failed' ) -> incr ( ) ; $ this -> getStatistic ( 'failed' ) -> incr ( ) ; }
Marks the given job as failed

This happens whenever the job's perform() method emits an exception

@param JobInterface|array $job
@param Exception $exception
Marks the given job as failed