Error/Exception Handling
Kohana provides both an exception handler and an error handler that transforms errors into exceptions using PHP's
ErrorException class. Many details of the error and the internal state of the application is displayed by the handler:
- Exception class
- Error level
- Error message
- Source of the error, with the error line highlighted
- A debug backtrace of the execution flow
- Included files, loaded extensions, and global variables
Example
Click any of the links to toggle the display of additional information:
ErrorException [ Notice ]: Undefined variable: var_does_not_exist
MODPATH/userguide/views/userguide/examples/error.php [ 4 ]
<span class = "line" ><span class = "number" >1</span> <?php |
</span><span class = "line" ><span class = "number" >2</span> |
</span><span class = "line" ><span class = "number" >3</span> |
</span><span class = "line highlight" ><span class = "number" >4</span> echo $var_does_not_exist ; |
</span><span class = "line" ><span class = "number" >5</span> |
</span><span class = "line" ><span class = "number" >6</span> ?></span> |
{PHP internal call} » Controller_Userguide->action_docs(
arguments)
Disabling Error/Exception Handling
If you do not want to use the internal error handling, you can disable it when calling
Kohana::init:
Kohana::init( array ( 'errors' => FALSE)); |
1 comments:
dsdasda
Post a Comment