master

laravel/framework

Last updated at: 29/12/2023 09:24

JobFailed.php

TLDR

The JobFailed.php file in the Illuminate\Queue\Events namespace defines a class JobFailed which represents an event when a job fails in the queue. It contains properties for the connection name, job instance, and the exception that caused the job to fail.

Classes

JobFailed

The JobFailed class represents an event when a job fails in the queue. It has the following properties:

  • connectionName: The connection name.
  • job: The job instance.
  • exception: The exception that caused the job to fail.

It also has a constructor that accepts the connection name, job instance, and exception as parameters and initializes the corresponding properties.

<?php

namespace Illuminate\Queue\Events;

class JobFailed
{
    /**
     * The connection name.
     *
     * @var string
     */
    public $connectionName;

    /**
     * The job instance.
     *
     * @var \Illuminate\Contracts\Queue\Job
     */
    public $job;

    /**
     * The exception that caused the job to fail.
     *
     * @var \Throwable
     */
    public $exception;

    /**
     * Create a new event instance.
     *
     * @param  string  $connectionName
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  \Throwable  $exception
     * @return void
     */
    public function __construct($connectionName, $job, $exception)
    {
        $this->job = $job;
        $this->exception = $exception;
        $this->connectionName = $connectionName;
    }
}