mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-20 18:32:59 +08:00
20160611
This commit is contained in:
@ -3,10 +3,14 @@ Handling Errors
|
||||
|
||||
Yii includes a built-in [[yii\web\ErrorHandler|error handler]] which makes error handling a much more pleasant
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
experience than before. In particular, the Yii error handler does the followings to improve error handling:
|
||||
=======
|
||||
experience than before. In particular, the Yii error handler does the following to improve error handling:
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
experience than before. In particular, the Yii error handler does the following to improve error handling:
|
||||
>>>>>>> master
|
||||
|
||||
* All non-fatal PHP errors (e.g. warnings, notices) are converted into catchable exceptions.
|
||||
* Exceptions and fatal PHP errors are displayed with detailed call stack information and source code lines
|
||||
@ -148,13 +152,23 @@ the following variables if the error action is defined as [[yii\web\ErrorAction]
|
||||
* `exception`: the exception object through which you can retrieve more useful information, such as HTTP status code,
|
||||
error code, error call stack, etc.
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
> Info: If you are using the [basic application template](start-installation.md) or the [advanced application template](tutorial-advanced-app.md),
|
||||
=======
|
||||
> Info: If you are using the [basic project template](start-installation.md) or the [advanced project template](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md),
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
> Info: If you are using the [basic project template](start-installation.md) or the [advanced project template](https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md),
|
||||
>>>>>>> master
|
||||
the error action and the error view are already defined for you.
|
||||
|
||||
> Note: If you need to redirect in an error handler, do it the following way:
|
||||
> ```php
|
||||
> Yii::$app->getResponse()->redirect($url)->send();
|
||||
> return;
|
||||
> ```
|
||||
|
||||
|
||||
### Customizing Error Response Format <span id="error-format"></span>
|
||||
|
||||
|
Reference in New Issue
Block a user