You can do what you want, but this includes changing the CodeIgniter core. CodeIgniter defines a custom PHP error handling when calling the function below in the /system/core/CodeIgniter.php
file:
set_error_handler('_error_handler');
And exception handling passes to the _error_handler( )
function in the /system/core/Commom.php
file. Note that this is the scope of the variables you want to use:
function _error_handler($severity, $message, $filepath, $line) {
$is_error = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);
if ($is_error)
set_status_header(500);
if (($severity & error_reporting()) !== $severity)
return;
$_error =& load_class('Exceptions', 'core');
$_error->log_exception($severity, $message, $filepath, $line);
if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors')))
// AQUI ESTÃO AS VARIÁVEIS PRONTAS QUE VOCÊ DESEJA
// O CODEIGNITER ESTÁ PRONTO PARA CHAMAR A VIEW
// INSIRA DADOS NO BANCO AQUI, DE ACORDO COM USUÁRIO LOGADO, EXCEÇÃO, ETC...
// $severity, $message, $filepath, $line !!!
$_error->show_php_error($severity, $message, $filepath, $line);
if ($is_error)
exit(1); // EXIT_ERROR
}