Welcome Guest, Not a member yet? Register   Sign In
How to prevent CI from dumping SQL on screen when err occurs?
#11

[eluser]Derek Allard[/eluser]
I wrote something about CI error handling once... I hope its helpful.
Error Handling in CodeIgniter
#12

[eluser]gtech[/eluser]
Thanks for that Derek, I did read it and it is very useful!

But the problem I had to solve was a different one, as I am not writing a publicly visible web site.. more an application that runs on a webserver which a GUI can connect to either via XMLRPC or with the GUI code running on the same server (its multipurpose).

I wanted to separate my code (the model code and datamodel) from the GUI code (say controllers/views or any other technology). So that another developer (in-house or third party) can develop the front end GUI Intended for internal use.

To cut a long story short all my APIs (model functions) return in a consistent format [<error type>,<error number>,<error message>,<return value>]
Quote:error type = 0 (no error), 1 (DB error), 2 (application error)
error number = the database error number or the application error number used for language translation,0 if ok
error message = the actual error message, blank if ok
return value = whatever the function returns.
In this instance I catch the database error messages (as shown in reply 3, and turn db_debug to FALSE).


this is why I find db->_error_message and db->_error_number very useful functions to have, and they work brilliantly, but I had to dig out all CIs database code to find out that I could actually do this instead of it being in the documentation.

do you think there is a case for making db->_error_message and db->_error_number external functions?
#13

[eluser]Derek Allard[/eluser]
I've truthfully not thought about it, but I'd be interested in any libraries you produce.
#14

[eluser]gtech[/eluser]
Ok, I will have a go later on today or tomorrow and post up what i've done.




Theme © iAndrew 2016 - Forum software by © MyBB