![]() |
Retrieve error backtrace - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Retrieve error backtrace (/showthread.php?tid=3919) |
Retrieve error backtrace - El Forum - 10-29-2007 [eluser]iive[/eluser] I wonder is there any how I can retrieve the stacktrace when there is an error in our php coding or database error? For example: let's say I have a database error in my Model, can CI trace back on the screen where this error comes from (the model name, the line in the model.php etc...)? Instead of I see the MySql error message and I have to search through my Models to see which of them contains errors.. I hope my question is clear... and I really hope to know the answer.. thanks! Retrieve error backtrace - El Forum - 10-30-2007 [eluser]iive[/eluser] I really need help on this and I think this is a good feature in development process.. it saves a lot of times in debugging process. Anyone can help? Retrieve error backtrace - El Forum - 10-30-2007 [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) { you can then handle db errors whenever they occur Code: $ret = $this->calldb->insert($table, $data_array, 1); |