Welcome Guest, Not a member yet? Register   Sign In
Retrieve error backtrace
#3

[eluser]gtech[/eluser]
Hello,

I have done a little bit of research on reading this but cannot find a stacktrace within the codeigniter framework. I know there is a debug_backtrace() in php4 / 5 and it works within codeigniter and may be what you want

You need to set db_debug to false in your config file, this will stop the MYSQL error page appearing and halting your application. (rollback needs db_debug to be false)

I have coded my applications to catch all database errors and report them cleanly.
I have mentioned this before in the forums so please forgive me for repeating myself :-S

what I have done is put all db calls into a function wrapper in a db_call model and then you can choose how to handle errors.


models/calldb.php
Code:
function insert($table, $data_array) {
  $res = $this->db->insert($table,$data_array);
  if (!$res) {
      $errNo   = $this->db->_error_number();
      $errMess = $this->db->_error_message();  
  }
  return array('ErrorN'=>$errNo,
                'ErrorM'=>$errMess);
}
...
// need to implement delete update get getwhere etc

you can then handle db errors whenever they occur

Code:
$ret = $this->calldb->insert($table, $data_array, 1);
  if ($ret['ErrorN']) {
    ...... what ever you want to do..., log the error, return it etc.
  }


Messages In This Thread
Retrieve error backtrace - by El Forum - 10-29-2007, 02:34 AM
Retrieve error backtrace - by El Forum - 10-30-2007, 02:41 AM
Retrieve error backtrace - by El Forum - 10-30-2007, 04:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB