[eluser]Mirage[/eluser]
Quote:But when i upgrade code igniter, all my changes will be overwriten, right?
That potential is always there and true for any core extensions, etc. you might apply for a given site. The errors directory is rarely updated so you can just exclude that from your updates, unless the upgrade doc instructs you to otherwise. Easy enough, though I'll admit that it'd make more sense for the distribution to have the error message templates in the system directory, overridden by those placed in the application directory.
Quote:Isn’t there a way to do this like hooks do for functions?
Depends on what you're trying to catch. The system provided classes will call show_error, show_404, etc pretty liberally. These global, public functions in turn call their counterparts in the Exceptions library. You could override the functionality in that library with a core extension. In the extension, simply override the error functions, calling your own sub-handlers (to send email, etc.) and then execute the parent function for business as usual:
MY_Exceptions.php
Code:
class MY_Exceptions extends CI_Exceptions {
function show_error($msg) {
// send email notification code and other stuff here
// perhaps with a hook?
global $EXT;
$EXT->_call_hook('my_special_error_hook');
// continue as usual
parent::show_error($msg);
}
}
HTH,
-m