1. yii\web\BadRequestHttpException: Status code 400.
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.
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
Chinese translation:
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 providing the user with more precise error information.
See also https://tools.ietf.org/html/rfc7231#section-6.5.1.
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, invalid request message, or deceptive request routing).
Notes:
(1) The HTTP 400 Bad Request response status code indicates that the server cannot understand the request due to invalid syntax. The client should not repeat this request without modification.
(2) Bad request. This may be caused by various reasons on the user side, such as invalid JSON data in the request body, invalid operation parameters, etc.
2. yii\web\ConflictHttpException: Status code 409.
ConflictHttpException represents a “Conflict” HTTP exception with status code 409.
See also https://tools.ietf.org/html/rfc7231#section-6.5.8.
The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and esubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.
Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the representation being PUT included changes to a resource that conflict with those made by an earlier (third-party) request, the origin server might use a 409 response to indicate that it can’t complete the request. In this case, the response representation would likely contain information useful for merging the differences based on the revision history.
Chinese translation:
ConflictHttpException represents a “Conflict” HTTP exception with status code 409.
See also https://tools.ietf.org/html/rfc7231#section-6.5.8.
The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server should generate a payload containing enough information for the user to identify the source of the conflict.
Conflicts are most likely to occur when responding to a PUT request. For example, if versioning is being used and the representation included in the PUT changes a resource that conflicts with an earlier (third-party) request, the origin server might use a 409 response to indicate that it cannot complete the request. In this case, the response representation would likely contain information useful for merging differences based on the revision history.
Notes:
(1) The 409 Conflict response status code indicates that the request conflicts with the current state of the target resource on the server side. Conflicts are most likely to occur in response to a PUT request. For example, when the version of an uploaded file is older than the one already existing on the server, resulting in a version conflict, a response with status code 409 might be received.
(2) Indicates that the request cannot be processed because of a conflict, such as an edit conflict between multiple simultaneous updates.
3. yii\web\ForbiddenHttpException: Status code 403.
ForbiddenHttpException represents a “Forbidden” HTTP exception with status code 403.
Use this exception when a user is not allowed to perform the requested action. Using different credentials might or might not allow performing the requested action. If you do not want to expose authorization information to the user, it is valid to respond with a 404 yii\web\NotFoundHttpException.
See also https://tools.ietf.org/html/rfc7231#section-6.5.3.
The 403 (Forbidden) status code indicates that the server understood the request but refuses to authorize it. A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).
If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.
An origin server that wishes to “hide” the current existence of a forbidden target resource MAY instead respond with a status code of 404 (Not Found).
Chinese translation:
ForbiddenHttpException represents a “Forbidden” HTTP exception with status code 403.
If the user is not allowed to perform the requested action, use this exception. Using different credentials may or may not allow the requested action to be performed. If you do not want to expose authorization information to the user, you can respond with a 404 yii\web\NotFoundHttpException.
See also https://tools.ietf.org/html/rfc7231#section-6.5.3.
The 403 (Forbidden) status code indicates that the server has understood the request but refuses to execute it. If the server wishes to make the reason for the forbidden request public, it can describe that reason in the response payload (if any).
If authentication credentials are provided in the request, the server considers them insufficient to grant access. The client should not automatically repeat the request with the same credentials. The client may repeat the request with new or different credentials. However, the request might be forbidden for reasons unrelated to the credentials.
If it wishes to “hide” the current existence of the forbidden target resource, the origin server can respond with a 404 (Not Found) status code.
Notes:
(1) The 403 Forbidden status code represents a client error, indicating that the server is capable of processing the request but refuses to authorize access. This status is similar to 401, but once this status is entered, authentication cannot continue. The access is permanently forbidden and is closely related to application logic (e.g., an incorrect password).
(2) The server has understood the request but refuses to execute it. Unlike a 401 response, authentication does not help, and this request should not be repeated. If this is not a HEAD request and the server wishes to clarify why the request cannot be executed, it should describe the reason for the refusal within the entity. Of course, the server can also return a 404 response if it does not want to provide the client with any information.
(3) An authenticated user is not allowed to access the specified API endpoint.
4. yii\web\GoneHttpException: 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 yii\web\NotFoundHttpException.
See also https://tools.ietf.org/html/rfc7231#section-6.5.9.
The 410 (Gone) status code indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent. If the origin server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) ought to be used instead.
The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer associated with the origin server’s site. It is not necessary to mark all permanently unavailable resources as “gone” or to keep the mark for any length of time — that is left to the discretion of the server owner.
A 410 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls (see Section 4.2.2 of [RFC7234]).
Chinese translation:
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 yii\web\NotFoundHttpException.
See also https://tools.ietf.org/html/rfc7231#section-6.5.9.
The 410 (Gone) status code indicates that the target resource is no longer accessible on the origin server, and this condition is likely to be permanent. If the origin server does not know or cannot determine whether the condition is permanent, the 404 (Not Found) status code should be used instead.
The 410 response is primarily intended to assist in web maintenance tasks by notifying the recipient that the resource is intentionally unavailable and that the server owners wish to remove remote links to that resource. Such events are common for limited-time, promotional services, and for resources belonging to individuals no longer associated with the origin server’s site. It is not necessary to mark all permanently unavailable resources as “gone” or to keep the mark for any length of time—this is left to the discretion of the server owner.
By default, a 410 response is cacheable; i.e., unless the method definition or explicit cache controls state otherwise (see Section 4.2.2 of [RFC7234]).
Notes:
(1) HTTP 410 Gone indicates that the requested content no longer exists on the server and is permanently unavailable. If it is unclear whether the unavailability is permanent or temporary, 404 should be used. The 410 response is cached by default.
(2) Indicates that the requested resource is no longer available and will not be available again. This should be used when a resource is intentionally deleted and the resource should be purged. Upon receiving a 410 status code, the user should stop requesting the resource again. [39] However, most servers do not use this status code and instead directly use the 404 status code.
5. yii\web\MethodNotAllowedHttpException: Status code 405.
MethodNotAllowedHttpException represents a “Method Not Allowed” HTTP exception with status code 405.
See also https://tools.ietf.org/html/rfc7231#section-6.5.5.
The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource. The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource’s currently supported methods.
A 405 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls (see Section 4.2.2 of [RFC7234]).
Chinese translation:
MethodNotAllowedHttpException represents a “Method Not Allowed” HTTP exception with status code 405.
See also https://tools.ietf.org/html/rfc7231#section-6.5.5.
The 405 (Method Not Allowed) status code indicates that the method received in the request line is known by the origin server but not supported by the target resource. The origin server must generate an Allow header field in the 405 response, containing a list of the methods currently supported by the target resource.
By default, a 405 response is cacheable; i.e., unless the method definition or explicit cache controls state otherwise (see Section 4.2.2 of [RFC7234]).
Notes:
(1) The 405 Method Not Allowed status code indicates that the server has forbidden the request using the current HTTP method. Note that the GET and HEAD methods must not be forbidden, and naturally, must not return a 405 status code.
(2) The request method specified in the request line cannot be used for the corresponding resource. The response must return an Allow header indicating a list of request methods acceptable for the current resource. For example, a GET request on a form that requires POST to submit data, or a PUT request on a read-only resource.
Since PUT and DELETE methods perform write operations on server resources, most web servers do not support or do not allow these request methods in their default configuration, returning a 405 error for such requests.
(3) Method not allowed. Please check the HTTP methods allowed by the Allow header.
6. yii\web\NotAcceptableHttpException: 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.
See also https://tools.ietf.org/html/rfc7231#section-6.5.6.
The 406 (Not Acceptable) status code indicates that the target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request (Section 5.3), and the server is unwilling to supply a default representation.
The server SHOULD generate a payload containing a list of available representation characteristics and corresponding resource identifiers from which the user or user agent can choose the one most appropriate. A user agent MAY automatically select the most appropriate choice from that list. However, this specification does not define any standard for such automatic selection, as described in Section 6.4.1.
Chinese translation:
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.
The 406 (Not Acceptable) status code indicates that the target resource does not have a current representation acceptable to the user agent, based on the proactive negotiation header fields received in the request (Section 5.3), and the server is unwilling to provide a default representation.
The server should generate a payload containing a list of available representation characteristics and corresponding resource identifiers, from which the user or user agent can choose the most appropriate one. The user agent may automatically select the most appropriate option from this list. However, this specification does not define any standard for such automatic selection, as described in Section 6.4.1.
Notes:
(1) The 406 Not Acceptable status code in the HTTP protocol indicates a client error, referring to the server’s inability to provide a response matching the values specified by the Accept-Charset and Accept-Language message headers.
In practice, this error status code is rarely used: instead of returning an obscure (and difficult to correct) error status code to the user, the relevant message headers are ignored, and a tangible page is provided to the user. This practice is based on the assumption that even if it does not fully satisfy the user, it is better than returning an error status code.
If the server returns this error status code, the message body should contain a list of available resource representations, allowing the user to manually select.
(2) See also: Content negotiation. The content characteristics of the requested resource cannot satisfy the conditions in the request headers, and thus a response entity cannot be generated; the request is not acceptable.
Unless this is a HEAD request, the response should return an entity containing a list of entity characteristics and addresses from which the user or browser can choose the most appropriate. The format of the entity is determined by the media type defined in the Content-Type header. The browser can automatically make the best choice based on the format and its own capabilities. However, the specification does not define any standard for making such automatic selections.
7. yii\web\NotFoundHttpException: Status code 404.
NotFoundHttpException represents a “Not Found” HTTP exception with status code 404.
See also https://tools.ietf.org/html/rfc7231#section-6.5.4.
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists. A 404 status code does not indicate whether this lack of representation is temporary or permanent; the 410 (Gone) status code is preferred over 404 if the
origin server knows, presumably through some configurable means, that the condition is likely to be permanent.
A 404 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls (see Section 4.2.2 of [RFC7234]).
Chinese translation:
NotFoundHttpException represents a “Not Found” HTTP exception with status code 404.
See also https://tools.ietf.org/html/rfc7231#section-6.5.4.
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource, or is unwilling to disclose that it exists. The 404 status code does not indicate whether the lack of representation is temporary or permanent; if so, the 410 (Gone) status code is preferred over 404
The origin server might know, presumably through some configurable means, that the condition is likely to be permanent.
By default, a 404 response is cacheable; i.e., unless the method definition or explicit cache controls state otherwise (see Section 4.2.2 of [RFC7234]).
Notes:
(1) The 404 Not Found status code represents a client error, indicating that the server cannot find the requested resource. Links returning this response are often referred to as broken links or dead links, and they lead to link rot pages.
The 404 status code does not indicate whether the requested resource is temporarily or permanently gone. If the server knows that the resource is permanently gone, it should return 410 (Gone) instead of 404.
(2) The request failed; the resource desired by the request was not found on the server, but subsequent requests by the user are allowed. There is no information to tell the user whether this situation is temporary or permanent. If the server knows the situation, it should use the 410 status code to inform that the old resource is permanently unavailable due to some internal configuration mechanism, and there is no forwarding address. The 404 status code is widely used when the server does not want to reveal exactly why the request was rejected, or when no other suitable response is available.
8. yii\web\ServerErrorHttpException: Status code 500.
ServerErrorHttpException represents an “Internal Server Error” HTTP exception with status code 500.
See also https://tools.ietf.org/html/rfc7231#section-6.6.1.
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
Chinese translation:
ServerErrorHttpException represents an “Internal Server Error” HTTP exception with status code 500.
See also https://tools.ietf.org/html/rfc7231#section-6.6.1.
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from completing the request.
Notes:
(1) In the HTTP protocol, 500 Internal Server Error is a response status code indicating a server-side error, meaning that the requested server encountered an unexpected condition that prevented it from executing the request.
This error code is a generic “catch-all” response code. Typically, server administrators will log more detailed information about requests that trigger errors like 500 to prevent the same errors from occurring in the future.
(2) A generic error message indicating that the server encountered an unexpected condition that prevented it from completing the processing of the request. No specific error information is given.
(3) Internal server error. This may be caused by an internal program error.
9. yii\web\TooManyRequestsHttpException: 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.
See also https://tools.ietf.org/html/rfc6585#section-4.
The 429 status code indicates that the user has sent too many requests in a given amount of time (“rate limiting”).
The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.
Note that this specification does not define how the origin server identifies the user, nor how it counts requests. For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server,or even among a set of servers. Likewise, it might identify the user by its authentication credentials, or a stateful cookie.
Responses with the 429 status code MUST NOT be stored by a cache.
Chinese translation:
TooManyRequestsHttpException represents a “Too Many Requests” HTTP exception with status code 429.
Use this exception to indicate that the client has made too many requests within a given time period. For example, this exception would be thrown when ‘throttling’ an API user.
See also https://tools.ietf.org/html/rfc6585#section-4.
The 429 status code indicates that the user has sent too many requests within a given amount of time (“rate limiting”).
The response representation should include details explaining the condition, and may include a Retry-After header indicating how long to wait before making a new request.
Note that this specification does not define how the origin server identifies the user, nor does it define how it counts requests. For example, an origin server limiting request rates might do so based on request counts per resource, across the entire server, or even among a set of servers. Likewise, it might identify the user by their authentication credentials or a stateful cookie.
Responses with the 429 status code must not be stored by a cache.
Notes:
(1) In the HTTP protocol, the 429 Too Many Requests response status code indicates that the user has sent too many requests within a given amount of time, exceeding the “rate limit”.
In the response, a Retry-After header can be provided to indicate how long the user should wait before sending a new request.
(2) The user has sent too many requests within a given amount of time. Intended for use in network rate limiting.
10. yii\web\UnauthorizedHttpException: Status code 401.
UnauthorizedHttpException represents an “Unauthorized” HTTP exception with status code 401.
Use this exception to indicate that a client needs to authenticate via WWW-Authenticate header to perform the requested action.
If the client is already authenticated and is simply not allowed to perform the action, consider using a 403 yii\web\ForbiddenHttpException or 404 yii\web\NotFoundHttpException instead.
Chinese translation:
UnauthorizedHttpException represents an “Unauthorized” HTTP exception with status code 401.
Use this exception to indicate that the client needs to authenticate via the WWW-Authenticate header to perform the requested action.
If the client is already authenticated and is simply not allowed to perform the action, consider using a 403 yii\web\ForbiddenHttpException or 404 yii\web\NotFoundHttpException instead.
Notes:
(1) The 401 Unauthorized status code represents a client error, indicating that the sent request was not satisfied due to a lack of authentication credentials required by the target resource.
This status code is sent along with a WWW-Authenticate header, which contains information on how to authenticate.
This status is similar to 403, but in this case, authentication is still possible.
(2) Similar to 403 Forbidden, the semantics of 401 is “Unauthorized”, meaning the user lacks the necessary credentials. This status code indicates that the current request requires user authentication. The response must contain a WWW-Authenticate header appropriate for the requested resource to prompt the user for information. The client may repeat the request with an appropriate Authorization header. If the current request already includes Authorization credentials, the 401 response indicates that the server has rejected those credentials during verification. If the 401 response contains the same authentication challenge as the previous response, and the browser has already attempted authentication at least once, the browser should display the entity information contained in the response to the user, as this entity information may contain relevant diagnostic information.
Note: When a website (usually a website domain) bans an IP address, some websites display a 401 status code, indicating that the specific address is denied access to the website.
11. yii\web\UnsupportedMediaTypeHttpException: 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.
See also https://tools.ietf.org/html/rfc7231#section-6.5.13.
The 415 (Unsupported Media Type) status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource. The format problem might be due to the request’s indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.
Chinese translation:
UnsupportedMediaTypeHttpException represents an “Unsupported Media Type” HTTP exception with status code 415.
Use this exception when the client sends data in a format that the application cannot understand. For example, this exception would be thrown if the client POSTs XML data to an action or controller that only accepts JSON.
See also https://tools.ietf.org/html/rfc7231#section-6.5.13.
The 415 (Unsupported Media Type) status code indicates that the origin server refuses to service the request because the payload is in a format not supported by this method on the target resource. The format problem might be due to the request indicating a Content-Type or Content-Encoding, or it might be the result of directly inspecting the data.
Notes:
(1) 415 Unsupported Media Type is an HTTP protocol error status code, indicating that the server refuses to accept the client’s request because it does not support the format of the payload.
The format problem might arise from the format specified by the client in the Content-Type or Content-Encoding header, or it might be the result of directly inspecting the payload data.
(2) The internet media type submitted in the request is not a format supported by the server for the current request method and the requested resource, so the request is rejected. For example, the client uploads an image in svg format, but the server requires the image to be uploaded in jpg format.
12. yii\web\RangeNotSatisfiableHttpException: Status code 416.
RangeNotSatisfiableHttpException represents an exception caused by an improper request of the end-user.
This exception thrown when the requested range is not satisfiable: the client asked for a portion of the file (byte serving), but the server cannot supply that portion. For example, if the client asked for a part of the file that lies beyond the end of the file.
Throwing an RangeNotSatisfiableHttpException like in the following example will result in the error page with error 416 to be displayed.
Chinese translation:
RangeNotSatisfiableHttpException represents an exception caused by an improper request from the end user.
This exception is thrown when the requested range cannot be satisfied: the client requests a portion of the file (byte serving), but the server cannot provide that portion. For example, if the client requests a portion of the file that lies beyond the end of the file.
Throwing a RangeNotSatisfiableHttpException, as shown in the following example, will result in an error page displaying a 416 error.
Notes:
(1) The HTTP 416 Range Not Satisfiable error status code means that the server cannot process the requested data range. The most common situation is that the requested data range is outside the file boundaries; in other words, the value of the Range header, while syntactically correct, is semantically meaningless.
The 416 response message contains a Content-Range header, indicating the unsatisfiable data range (represented by an asterisk *), followed by a “/”, and then the length of the current resource. For example: Content-Range: */12777
When encountering this error status code, browsers generally adopt one of two strategies: either terminate the operation (for example, an interrupted download operation is considered unrecoverable), or request the entire file again.
(2) Abbreviated as “Requested Range Not Satisfiable”. The client has requested a portion of the file (byte serving), but the server cannot provide that portion. For example, if the client requests a portion of the file that is beyond the end of the file.
13. yii\web\UnprocessableEntityHttpException: Status code 422.
UnprocessableEntityHttpException represents an “Unprocessable Entity” HTTP exception with status code 422.
Use this exception to inform that the server understands the content type of the request entity and the syntax of that request entity is correct but the server was unable to process the contained instructions. For example, to return form validation errors.
Chinese translation:
UnprocessableEntityHttpException represents an “Unprocessable Entity” HTTP exception with status code 422.
Use this exception to inform the recipient that the server understands the content type of the request entity, and the syntax of the request entity is correct, but the server cannot process the contained instructions. For example, returning form validation errors.
Notes:
(1) The HTTP 422 response code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but the server cannot process the contained instructions.
(2) The request format is correct, but it cannot be responded to due to semantic errors.
(3) Data validation failed (e.g., in response to a POST request). Please check the detailed error message in the response body.

