summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/general/errors.rst
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src/source/general/errors.rst')
-rw-r--r--user_guide_src/source/general/errors.rst21
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..1d6f8120d 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_FAILURE``. 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_UNK_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.