NotAcceptableHttpException.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\web;
  8. /**
  9. * NotAcceptableHttpException represents a "Not Acceptable" HTTP exception with status code 406.
  10. *
  11. * Use this exception when the client requests a Content-Type that your
  12. * application cannot return. Note that, according to the HTTP 1.1 specification,
  13. * you are not required to respond with this status code in this situation.
  14. *
  15. * @see https://tools.ietf.org/html/rfc7231#section-6.5.6
  16. * @author Dan Schmidt <danschmidt5189@gmail.com>
  17. * @since 2.0
  18. */
  19. class NotAcceptableHttpException extends HttpException
  20. {
  21. /**
  22. * Constructor.
  23. * @param string $message error message
  24. * @param int $code error code
  25. * @param \Exception $previous The previous exception used for the exception chaining.
  26. */
  27. public function __construct($message = null, $code = 0, \Exception $previous = null)
  28. {
  29. parent::__construct(406, $message, $code, $previous);
  30. }
  31. }