Skip to content
PHP Ecosystem
Explore

TooManyRequestsHttpException

API reference › yii › web › TooManyRequestsHttpException

classyii\web\TooManyRequestsHttpException
ExtendsHttpException » yii\base\UserException » yii\base\Exception » Exception
Since2.0
Sourceframework/web/TooManyRequestsHttpException.php

TooManyRequestsHttpException represents a “Too Many Requests” HTTP exception with status code 429.

Use this exception to indicate that a client has made too many requests in a given period of time. For example, you would throw this exception when ‘throttling’ an API user.

See also: https://tools.ietf.org/html/rfc6585#section-4.

PropertyTypeDescriptionDefined by
$statusCodeintHTTP status code, such as 403, 404, 500, etc. Default: null.HttpException
MethodDescriptionDefined by
__construct()Constructor.TooManyRequestsHttpException
getName()HttpException
public function __construct(string|null $message = null, int $code = 0, Throwable|null $previous = null)

Constructor.

Parameters

ParameterTypeDescription
$messagestring|nullError message
$codeintError code
$previousThrowable|nullThe previous exception used for the exception chaining.