Skip to content
PHP Ecosystem
Explore

BadRequestHttpException

API reference › yii › web › BadRequestHttpException

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

BadRequestHttpException represents a “Bad Request” HTTP exception with status code 400.

Use this exception to represent a generic client error. In many cases, there may be an HTTP exception that more precisely describes the error. In that case, consider using the more precise exception to provide the user with additional information.

See also: https://tools.ietf.org/html/rfc7231#section-6.5.1.

PropertyTypeDescriptionDefined by
$statusCodeintHTTP status code, such as 403, 404, 500, etc. Default: null.HttpException
MethodDescriptionDefined by
__construct()Constructor.BadRequestHttpException
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.