Commit 482e56da by Qiang Xue

finished error handling guide [skip ci]

parent c273e066
...@@ -49,7 +49,6 @@ Sometimes you may want to customize the default error response format. For examp ...@@ -49,7 +49,6 @@ Sometimes you may want to customize the default error response format. For examp
using different HTTP statuses to indicate different errors, you would like to always use 200 as HTTP status using different HTTP statuses to indicate different errors, you would like to always use 200 as HTTP status
and enclose the actual HTTP status code as part of the JSON structure in the response, like shown in the following, and enclose the actual HTTP status code as part of the JSON structure in the response, like shown in the following,
``` ```
HTTP/1.1 200 OK HTTP/1.1 200 OK
Date: Sun, 02 Mar 2014 05:31:43 GMT Date: Sun, 02 Mar 2014 05:31:43 GMT
......
...@@ -162,6 +162,10 @@ under the categories whose names match either `yii\db\*` or `yii\web\HttpExcepti ...@@ -162,6 +162,10 @@ under the categories whose names match either `yii\db\*` or `yii\web\HttpExcepti
] ]
``` ```
> Info: When an HTTP exception is caught by the [error handler](runtime-handling-errors.md), an error message
will be logged with the category name in the format of `yii\web\HttpException:ErrorCode`. For example,
the [[yii\web\NotFoundHttpException]] will cause an error message of category `yii\web\HttpException:404`.
### Message Formatting <a name="message-formatting"></a> ### Message Formatting <a name="message-formatting"></a>
......
...@@ -32,8 +32,8 @@ runtime-requests.md | Yes ...@@ -32,8 +32,8 @@ runtime-requests.md | Yes
runtime-responses.md | Yes runtime-responses.md | Yes
runtime-sessions-cookies.md | Yes runtime-sessions-cookies.md | Yes
runtime-url-handling.md | runtime-url-handling.md |
runtime-handling-errors.md | runtime-handling-errors.md | Yes
runtime-logging.md | runtime-logging.md | Yes
concept-components.md | Yes concept-components.md | Yes
concept-properties.md | Yes concept-properties.md | Yes
concept-events.md | Yes concept-events.md | Yes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment