Call the failed method on the job instance.

@return void
975866
public function failed(array $data)
	{
		$handler = $this->dispatcher->resolveHandler($command = unserialize($data['command']));

		if (method_exists($handler, 'failed'))
		{
			call_user_func([$handler, 'failed'], $command);
		}
	}
1310088
protected function raiseFailedJobEvent( $connection, Job $job, $failedId )
	{
		$data = json_decode( $job->getRawBody(), true );
		Framework::hooks()->trigger( 'queue.job.failed', compact( 'connection', 'job', 'data', 'failedId' ) );
	}
684292
public function executeJob()
    {
        $this->markStarted();
        try {
            $resultMsg = $this->run();
            if (strlen($resultMsg) == 0) {
                $resultMsg = t('The Job was run successfully.');
            }
            $error = static::JOB_SUCCESS;
        } catch (\Exception $e) {
            $resultMsg = $e->getMessage();
            $error = static::JOB_ERROR_EXCEPTION_GENERAL;
        }

        $je = new Event($this);
        Events::dispatch('on_job_execute', $je);

        $obj = $this->markCompleted($error, $resultMsg);

        return $obj;
    }
901994
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();
    }
369192
protected function handleFailedJob(JobInterface $job, \Exception $exception)
    {
        if ($job instanceof TrackableJobInterface) {
            $job->setState(JobInterface::STATE_FAILED);
        }

        $this->getLogger()->error(
            'Perform failure on {job}, {message}',
            array(
                'job' => $job,
                'message' => $exception->getMessage(),
                'exception' => $exception
            )
        );

        $this->eventDispatcher->dispatch(
            ResqueJobEvents::FAILED,
            new JobFailedEvent($job, $exception, $this)
        );
    }
385896
private function setFailure() : void
    {
        $this->session->set('failure',      $this->session->get('failure') + 1);
        $this->session->set('failure_time', time() + (int) static::FAILURE_TIME);
    }
858359
public function handle(JobFailed $event)
    {
        $this->jobs->failed(
            $event->exception, $event->connectionName,
            $event->queue, $event->payload
        );
    }
185451
public function fire()
	{
		$rows = array();

		foreach ($this->flyphp['queue.failer']->all() as $failed)
		{
			$rows[] = array_values(array_except((array) $failed, array('payload')));
		}

		if (count($rows) == 0)
		{
			return $this->info('No failed jobs!');
		}

		$table = $this->getHelperSet()->get('table');

		$table->setHeaders(array('ID', 'Connection', 'Queue', 'Failed At'))
              ->setRows($rows)
              ->render($this->output);
	}
843598
public function updateFailedJobAttempts()
    {
        $query = "
            SELECT * FROM job
            WHERE
                `status` = '" . CronManager::FAILED . "' AND
                deleted = 0 AND
                execute_time <= '".date('Y-m-d H:i:s')."' AND
                attempts > 0
        ";

        $pdo = $this->getEntityManager()->getPDO();
        $sth = $pdo->prepare($query);
        $sth->execute();

        $rows = $sth->fetchAll(PDO::FETCH_ASSOC);
        if ($rows) {
            foreach ($rows as $row) {
                $row['failed_attempts'] = isset($row['failed_attempts']) ? $row['failed_attempts'] : 0;

                $attempts = $row['attempts'] - 1;
                $failedAttempts = $row['failed_attempts'] + 1;

                $update = "
                    UPDATE job
                    SET
                        `status` = '" . CronManager::PENDING ."',
                        attempts = ".$pdo->quote($attempts).",
                        failed_attempts = ".$pdo->quote($failedAttempts)."
                    WHERE
                        id = ".$pdo->quote($row['id'])."
                ";
                $pdo->prepare($update)->execute();
            }
        }
    }
825562
public function process_failure() {
		if ( ! count( $this->results ) || ! count( $this->not_valid_actions ) ) {
			return;
		}

		foreach ( $this->not_valid_actions as $action ) {
			switch ( $action ) {
				case 'deactivate':
					deactivate_plugins( $this->get_plugin( 'basename' ), true );

					if ( isset( $_GET['activate'] ) ) {
						unset( $_GET['activate'] );
					}
					break;

				case 'admin_notice':
					add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
					break;
			}
		}
	}
741111
public function fire()
	{
		if ($this->laravel['queue.failer']->forget($this->argument('id'))) {
			$this->info('Failed job deleted successfully!');
		} else {
			$this->error('No failed job matches the given ID.');
		}
	}
696443
private function initFailureFile()
    {
        $this->baseDir = getenv('GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR');
        if ($this->baseDir === false) {
            $this->baseDir = sprintf(
                '%s/batch-daemon-failure',
                sys_get_temp_dir()
            );
        }
        if (! is_dir($this->baseDir)) {
            if (@mkdir($this->baseDir, 0700, true) === false) {
                throw new \RuntimeException(
                    sprintf(
                        'Couuld not create a directory: %s',
                        $this->baseDir
                    )
                );
            }
        }
        // Use getmypid for simplicity.
        $this->failureFile = sprintf(
            '%s/failed-items-%d',
            $this->baseDir,
            getmypid()
        );
    }
179655
public function fail()
    {
        $this->finished = true;
        if (!count($this->callback[self::TASK_FAIL])) {
            return;
        }

        foreach ($this->callback[self::TASK_FAIL] as $callback) {
            call_user_func($callback, $this);
        }
    }
264511
protected function raiseFailedJobEvent($connection, Job $job)
	{
		if ($this->events)
		{
			$this->events->fire('flyphp.queue.failed', array($connection, $job));
		}
	}
30462
protected function failJob($job, $e)
    {
        if ($job->isDeleted()) {
            return;
        }
        $job->delete();
        $job->failed($e);
    }
912184
protected function registerFailedJobServices()
    {
        $this->container->singleton('queue.failer', function () {
            $config = $this->container['config']['queue.failed'];

            return isset($config['table'])
                        ? $this->databaseFailedJobProvider($config)
                        : new NullFailedJobProvider;
        });
    }
1309161
protected function registerFailedJobsListener()
    {
        if (!in_array($this->app->environment(), config('nodes.bugsnag.notify_release_stages', []))) {
            return;
        }

        $shouldReport = config('nodes.bugsnag.report_failed_jobs');

        if ($shouldReport) {
            Queue::failing(function (JobFailed $event) {
                $exception = $event->exception;
                $meta = [
                    'job' => [
                        'name'     => $event->job->getName(),
                        'queue'    => $event->job->getQueue(),
                        'raw_body' => $event->job->getRawBody(),
                    ],
                    'connection' => [
                        'name' => $event->connectionName,
                    ],
                ];

                app('nodes.bugsnag')->notifyException($exception, function (\Bugsnag\Report $report) use ($meta) {
                    $report->setMetaData($meta, true);
                });
            });
        }
    }