Skip to content
PHP Ecosystem
Explore

NotAcceptableHttpException

API reference › yii › web › NotAcceptableHttpException

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

NotAcceptableHttpException represents a “Not Acceptable” HTTP exception with status code 406.

Use this exception when the client requests a Content-Type that your application cannot return. Note that, according to the HTTP 1.1 specification, you are not required to respond with this status code in this situation.

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

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