Error Checking



Fault checking is done in your proj- ect to determine what action should be taken in case of a fault occurring. The configuration file below shows the settings that you can use to determine how the system will behave if errors are encountered in your pros.

Configuration: Config / Project.php

 

 

# Configuration


The settings and usage in the specified file are as follows.

error
String $ mode = 'development' Which mode the project is running on. It needs to stay in this mode to perform error checking.
Int $ errorReporting = E_ALL Which error types will be reported. By default all error types are open.
Array $ escapeErrors = [] Which error types will not be considered. The names of these types of error sequences can be written as well as the number.
Array $ exitErrors = [0, 2] In case of which types of faults the system will be stopped.

 

 

# Mode


The project is broadcast mode. During the development phase of the project, it is ensured that the error checking can be turned on while on the fly.

Options
development This option is recommended during the project development phase. makes all error checks clear.
the publication This option should be preferred when the project is posted. Users are prevented from encountering possible errors or code interruptions.
the restoration This option should be preferred when working on certain sections of the project. Both users will not encounter possible errors and will make error checking for the section that is being worked on.
Use
'mode' => 'publication'

 

 

# Error Reporting


It is used to check if error checking is enabled in the system.

Options
E_ALL Error checking is turned on.
0 Error checking is turned off. 
TO_* Some of the E_ * options. Detailed use the link to click .
Use
'errorReporting' => E_ALL 

 

 

# Escape Errors


It is used to determine which error types will be ignored. That is, it is often the case for an undefined variable or array objectundefined type can be used to turn off errors.

Options

The keys or values ​​in the following line can be specified in this setting sequence.

Error code Error Name Explanation
0 ERROR Fatal error of working time. Errors that can not be remedied, such as a memory allocation problem, enter this class. Such errors will cause the script to stop working.
2nd WARNING Run-time warnings (non-fatal errors). Your work will not stop.
4 Purse Compile time resolution errors. It only resolves analysis errors.
8 NOTICE Runtime notifications. It may cause a fault in the script but it indicates that something was detected that could not occur during normal operation of the script.
16 CORE_ERR is Fatal fatal errors during PHP initialization. It is  like ERROR except that it is produced by PHP kernel  .
32 CORE_WARNING Warnings (non-fatal errors) that occur during PHP startup. It is  like WARNING except it is produced by PHP kernel  .
64 COMPILE_ERR is Deadly compile time error. Zend is  like ERROR except that it is produced by a scripting engine  .
128 COMPILE_WARNING Compile warning (non-fatal errors). Zend is  like WARNING except it is produced by a scripting engine  .
256 USER_ERROR User generated error messages. The PHP function is  like ERROR except that it is generated in PHP code   by trigger_error ()  .
512 USER_WARNING User generated warning messages. The PHP function is  like WARNING except that it is generated in PHP code   by trigger_error ()  .
1024 USER_NOTI by User production notification messages. The PHP function is  like NOTICE except that it is generated in PHP code   by trigger_error ()  .
2048 STRICT Enable the PHP -made recommendation to optimize the forward-looking compatibility and interoperability of the PHP code you write .
4096 RECOVERABLE_ERR is Capable fatal error. Indicates that a potentially dangerous error has occurred but does not leave the interpreter unstable. If the error is not caught by the user defining an activator, the script   terminates with an ERROR error.
8192 DEPRECATED Runtime notifications. Enables alerts about codes that will not work with future releases.
16384 USER_DEPRACATED User production notifications not recommended for use. The PHP function is  like DEPRECATED except that it is generated in PHP code   by trigger_error ()  .
32767 ALL  All errors and warnings supported ( except STRICT in PHP 6  ).
Use of
File: Controllers / home.php
<?php namespace Project\Controllers;

class Home extends Controller
{
    public function main()
    {
        echo $undefined;

        echo 'Code Continue';
    }   
}
Type: NOTICE
Error: Undefined variable: undefinedFile: /var/www/html/Projects/Example/Controllers/home.php
Line: 7

Code Continue
'escapeErrors' => ['NOTICE'];
Code Continue

 

 

# Exit Errors


It is used to decide which of the types of error that occur will stop the flow of code. In other words, while the values ​​specified in the array exitare terminated by the code stream in error according to the type, the code flow continues in the others.

Options

Escape is the same as the Errors options.

Use of 
'exitErrors' => [0, 2, 'NOTICE']
Type: NOTICE
Error: Undefined variable: undefinedFile: /var/www/html/Projects/Example/Controllers/home.php
Line: 9