master

laravel/framework

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

ThrottleRequestsException.php

TLDR

This file defines the ThrottleRequestsException class, which extends the TooManyRequestsHttpException class from Symfony\Component\HttpKernel\Exception. The class represents an exception that is thrown when the application exceeds the rate limit for making requests.

Classes

ThrottleRequestsException

The ThrottleRequestsException class extends the TooManyRequestsHttpException class from Symfony\Component\HttpKernel\Exception. It represents an exception that is thrown when the application exceeds the rate limit for making requests.

The class has a constructor method with the following signature:

public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0)
  • The $message parameter represents the error message associated with the exception.
  • The $previous parameter represents the previous exception that caused this exception, if any.
  • The $headers parameter represents an array of HTTP headers to be sent with the response.
  • The $code parameter represents the HTTP response code to be used when the exception is rendered.
<?php

namespace Illuminate\Http\Exceptions;

use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
use Throwable;

class ThrottleRequestsException extends TooManyRequestsHttpException
{
    /**
     * Create a new throttle requests exception instance.
     *
     * @param  string  $message
     * @param  \Throwable|null  $previous
     * @param  array  $headers
     * @param  int  $code
     * @return void
     */
    public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0)
    {
        parent::__construct(null, $message, $previous, $code, $headers);
    }
}