Official Laravel source
AttributeIlluminate\Queue\Attributes\MaxExceptions

#[MaxExceptions]

Limit the maximum number of exceptions a job can have.

Available since

Laravel 13.0

Targets

class

Parameters

  • $maxExceptionsint

    Maximum number of allowed exceptions.

Practical usage

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\Attributes\MaxExceptions;

#[MaxExceptions(5)]
class ProcessInvoice implements ShouldQueue
{
    public function handle(): void
    {
        //...
    }
}