TooManyRequestsHttpException.php 1019 B

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. * TooManyRequestsHttpException represents a "Too Many Requests" HTTP exception with status code 429.
  10. *
  11. * Use this exception to indicate that a client has made too many requests in a
  12. * given period of time. For example, you would throw this exception when
  13. * 'throttling' an API user.
  14. *
  15. * @see https://tools.ietf.org/html/rfc6585#section-4
  16. * @author Dan Schmidt <danschmidt5189@gmail.com>
  17. * @since 2.0
  18. */
  19. class TooManyRequestsHttpException 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(429, $message, $code, $previous);
  30. }
  31. }