diff options
author | Andrey Andreev <narf@bofh.bg> | 2013-03-04 13:59:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2013-03-04 13:59:53 +0100 |
commit | bb5cf0a51ce1aecf1dc5ebeb38336f59388321ef (patch) | |
tree | 81696844dd60466d1f1a1c0a4d8bbeb82f9a8b1c /user_guide_src | |
parent | fa01ae4b3a2ed51a93590527c04295eb8cba4e40 (diff) | |
parent | 8626e93d5b4362c86a58933dda9206ac8810476d (diff) |
Merge pull request #2190 from danhunsaker/feature/exit-status
Updated all CLI-valid cases of exit() to return a valid code
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/general/errors.rst | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 8c941aadb..441cedb80 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -18,6 +18,15 @@ procedural interfaces that are available globally throughout the application. This approach permits error messages to get triggered without having to worry about class/function scoping. +CodeIgniter also returns a status code whenever a portion of the core +calls ``exit()``. This exit status code is separate from the HTTP status +code, and serves as a notice to other processes that may be watching of +whether the script completed successfully, or if not, what kind of +problem it encountered that caused it to abort. These values are +defined in *application/config/constants.php*. While exit status codes +are most useful in CLI settings, returning the proper code helps server +software keep track of your scripts and the health of your application. + The following functions let you generate errors: show_error() @@ -36,7 +45,12 @@ following error template:: application/errors/error_general.php The optional parameter ``$status_code`` determines what HTTP status -code should be sent with the error. +code should be sent with the error. If ``$status_code`` is less than 100, +the HTTP status code will be set to 500, and the exit status code will +be set to ``$status_code + EXIT__AUTO_MIN``. If that value is larger than +``EXIT__AUTO_MAX``, or if ``$status_code`` is 100 or higher, the exit +status code will be set to ``EXIT_ERROR``. You can check in +*application/config/constants.php* for more detail. show_404() ========== @@ -53,8 +67,9 @@ the following error template:: application/errors/error_404.php The function expects the string passed to it to be the file path to the -page that isn't found. Note that CodeIgniter automatically shows 404 -messages if controllers are not found. +page that isn't found. The exit status code will be set to ``EXIT_UNKNOWN_FILE``. +Note that CodeIgniter automatically shows 404 messages if controllers are +not found. CodeIgniter automatically logs any ``show_404()`` calls. Setting the optional second parameter to FALSE will skip logging. |