Store a failed job event.

@param  \Illuminate\Queue\Events\JobFailed  $event
@return void
431903
protected function logFailedJob(JobFailed $event)
    {
        $this->laravel['queue.failer']->log(
            $event->connectionName, $event->job->getQueue(),
            $event->job->getRawBody(), $event->exception
        );
    }
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)
        );
    }
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' ) );
	}
694518
public function perform(Job $job)
    {
        // Set timeout so as to stop any hanged jobs
        // and turn off displaying errors as it fills
        // up the console
        set_time_limit($this->timeout);
        ini_set('display_errors', 0);

        $job->perform();

        $status = $job->getStatus();

        switch ($status) {
            case Job::STATUS_COMPLETE:
                $this->log('Done job <pop>'.$job.'</pop> in <pop>'.$job->execTimeStr().'</pop>', Logger::INFO);
                break;
            case Job::STATUS_CANCELLED:
                $this->log('Cancelled job <pop>'.$job.'</pop>', Logger::INFO);
                break;

            case Job::STATUS_FAILED:
                $this->log('Job '.$job.' failed: "'.$job->failError().'" in '.$job->execTimeStr(), Logger::ERROR);
                break;
            default:
                $this->log('Unknown job status "('.gettype($status).')'.$status.'" for <pop>'.$job.'</pop>', Logger::WARNING);
                break;
        }
    }
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();
            }
        }
    }
482248
protected function writeOutput(Job $job, $failed)
	{
		if ($failed)
		{
			$this->output->writeln('<error>Failed:</error> '.$job->getName());
		}
		else
		{
			$this->output->writeln('<info>Processed:</info> '.$job->getName());
		}
	}
1348506
public function fail($exception = null)
    {
        if ($this->job) {
            FailingJob::handle($this->job->getConnectionName(), $this->job, $exception);
        }
    }
48166
public function fail($attributes)
    {
        foreach ($this->locked as $idx => $job) {
            if ($job['id'] == $attributes['id']) {
                unset($this->locked[$idx]);
                break;
            }
        }

        $attributes['status'] = 'failed';
        $this->failed[] = $attributes;
    }
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;
        });
    }
653012
public function logFailedJob(JobInterface $job, $reason)
    {
        if (mb_strlen($reason) > 191) {
            $reason = mb_substr($reason, 0, 191);
        }

        $this->connection->transact(function () use ($job, $reason) {
            $this->connection->execute('INSERT INTO `' . self::FAILED_JOBS_TABLE_NAME . '` (`type`, `channel`, `batch_id`, `data`, `failed_at`, `reason`) VALUES (?, ?, ?, ?, ?, ?)', get_class($job), $job->getChannel(), $job->getBatchId(), json_encode($job->getData()), date('Y-m-d H:i:s'), $reason);
            $this->deleteJob($job);
        });
    }
1157300
public function handle(JobReleased $event)
    {
        $this->jobs->released($event->connectionName, $event->queue, $event->payload);
    }
983151
def store_failure_lines(job_log):
    """"""
    logger.debug('Running store_failure_lines for job %s', job_log.job.id)
    failureline.store_failure_lines(job_log)
1180224
public function fail($exception)
	{
		Resque_Event::trigger('onFailure', array(
			'exception' => $exception,
			'job' => $this,
		));

		$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
		Resque_Failure::create(
			$this->payload,
			$exception,
			$this->worker,
			$this->queue
		);
		Resque_Stat::incr('failed');
		Resque_Stat::incr('failed:' . $this->worker);
	}
574843
public function recordFailedJob(JobFailed $event)
    {
        if (! Telescope::isRecording()) {
            return;
        }

        $uuid = $event->job->payload()['telescope_uuid'] ?? null;

        if (! $uuid) {
            return;
        }

        Telescope::recordUpdate(EntryUpdate::make(
            $uuid, EntryType::JOB, [
                'status' => 'failed',
                'exception' => [
                    'message' => $event->exception->getMessage(),
                    'trace' => $event->exception->getTrace(),
                    'line' => $event->exception->getLine(),
                    'line_preview' => ExceptionContext::get($event->exception),
                ],
            ]
        )->addTags(['failed']));
    }
139669
protected function raiseFailedJobEvent($connectionName, $job, $e)
    {
        $this->events->dispatch(new Events\JobFailed(
            $connectionName, $job, $e
        ));
    }
476082
protected function raiseFailedJobEvent(Job $job)
	{
		$data = json_decode($job->getRawBody(), true);

		if($this->container->bound('events'))
		{
			$this->container['events']->fire('illuminate.queue.failed', array('sync', $job, $data));
		}
	}
81352
public static function handle($connectionName, $job, $e = null)
    {
        $job->markAsFailed();

        if ($job->isDeleted()) {
            return;
        }

        try {
            // If the job has failed, we will delete it, call the "failed" method and then call
            // an event indicating the job has failed so it can be logged if needed. This is
            // to allow every developer to better keep monitor of their failed queue jobs.
            $job->delete();

            $job->failed($e);
        } finally {
            static::events()->dispatch(new JobFailed(
                $connectionName, $job, $e ?: new ManuallyFailedException()
            ));
        }
    }