CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


Error Handling

Note: This page is an extension of the CodeIgniter User Guide page of the same name. Please read the CodeIgniter Error Handling page in addition to this page for complete information about this feature.

Overriding Error Templates

CoolBrew extends the error handling features by allowing the error templates to be overridden. You can place some or all of the error templates in the document root of each of your websites (specifically in the DOCPATH/errors/ folder) and customize the error messages for each site.

In addition, the default error templates have been moved to the system level folder rather than the applications or modules folders. If you have error templates in your modules or applications folders, they will be ignored.

The behavior of the following methods is extended as described:

show_error('message')

This function will display the error message supplied to it using the error_general.php error template. It will look for this template in two folders and will use the first one it finds:

  1. DOCPATH/errors/
  2. system/errors/

show_404('page')

This function will display the 404 error message supplied to it using the error_404.php error template. It will look for this template in two folders and will use the first one it finds:

  1. DOCPATH/errors/
  2. system/errors/

log_message('level', 'message')

This method works the same as in CodeIgniter except that with CoolBrew, you can choose to save log information at the document root of each of your websites. When logging information, CoolBrew will look for a writable log folder at DOCPATH/logs/, or at the path specified by $config['log_path'] if it's set in a document-level config file (DOCPATH/config/config.php) and write to that if it finds it.

If the document-level log folder is not found, it will log the information to the system's log file. The SITE_ID has been added to the log entries to help clarify which website triggered the the log entry in these cases.

Note: In order for the log file to actually be written, the "logs" folder in one or both locations must be writable. In addition, you must set the "threshold" for logging in the config.php file. You might, for example, only want error messages to be logged, and not the other two types. If you set it to zero logging will be disabled. The configuration for error logging can be customized for each website by using a document-level config file.