Adds docblock comments and HTTP spec links for the new HTTP Exception classes (#2103)

This commit is contained in:
Daniel Schmidt
2014-01-22 19:23:39 -08:00
parent f24454a458
commit 7fef8cf0cf
10 changed files with 110 additions and 6 deletions

View File

@@ -10,6 +10,12 @@ namespace yii\web;
/**
* 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.
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,9 @@
namespace yii\web;
/**
* ConflictHttpException represents a "Conflict" HTTP exception with status code 409.
* ConflictHttpException represents a "Conflict" HTTP exception with status code 409
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -10,6 +10,13 @@ namespace yii\web;
/**
* ForbiddenHttpException represents a "Forbidden" HTTP exception with status code 403.
*
* Use this exception when a user has been authenticated but is not allowed to
* perform the requested action. If the user is not authenticated, consider
* using a 401 [[UnauthorizedHttpException]]. If you do not want to
* expose authorization information to the user, it is valid to respond with a
* 404 [[NotFoundHttpException]].
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,14 @@
namespace yii\web;
/**
* GoneHttpException represents a "Gone" HTTP exception with status code 410.
* GoneHttpException represents a "Gone" HTTP exception with status code 410
*
* Throw a GoneHttpException when a user requests a resource that no longer exists
* at the requested url. For example, after a record is deleted, future requests
* for that record should return a 410 GoneHttpException instead of a 404
* [[NotFoundHttpException]].
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,13 @@
namespace yii\web;
/**
* NotAcceptableHttpException represents a "Not Acceptable" HTTP exception with status code 406.
* 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.
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,13 @@
namespace yii\web;
/**
* TooManyRequestsHttpException represents a "Too Many Requests" HTTP exception with status code 429.
* 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.
*
* @link http://tools.ietf.org/search/rfc6585#section-4
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,14 @@
namespace yii\web;
/**
* UnauthorizedHttpException represents an "Unauthorized" HTTP exception with status code 401.
* UnauthorizedHttpException represents an "Unauthorized" HTTP exception with status code 401
*
* Use this exception to indicate that a client needs to authenticate or login
* to perform the requested action. If the client is already authenticated and
* is simply not allowed to perform the action, consider using a 403
* [[ForbiddenHttpException]] or 404 [[NotFoundHttpException]] instead.
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/

View File

@@ -8,8 +8,14 @@
namespace yii\web;
/**
* UnsupportedMediaTypeHttpException represents an "Unsupported Media Type" HTTP exception with status code 415.
* UnsupportedMediaTypeHttpException represents an "Unsupported Media Type" HTTP exception with status code 415
*
* Use this exception when the client sends data in a format that your
* application does not understand. For example, you would throw this exception
* if the client POSTs XML data to an action or controller that only accepts
* JSON.
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16
* @author Dan Schmidt <danschmidt5189@gmail.com>
* @since 2.0
*/