CodeIgniter Forums
DBForge should move to using ErrorException - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: DBForge should move to using ErrorException (/showthread.php?tid=66387)



DBForge should move to using ErrorException - AmitMY - 10-18-2016

Currently, when DBForge encounters an error, for example: "CREATE DATABASE default" it shows an error.
I think it only makes sense it to just through an ErrorException, so it is catchable.


RE: DBForge should move to using ErrorException - Narf - 10-19-2016

It's not supposed to trigger errors in the first place ...


RE: DBForge should move to using ErrorException - AmitMY - 10-19-2016

I apologise. I meant to say that when I run it, and the database already exists, it shows an error.

Here is the error it is showing, when running `create_database("default")`

{
"heading":"A Database Error Occurred",
"message":[
"Error Number: 1007","Can't create database 'default'; database exists","CREATE DATABASE `default` CHARACTER SET utf8 COLLATE utf8_unicode_ci",
"Filename: ....\/system\/database\/DB_driver.php",
"Line Number: 691"
]
}

`CREATE DATABASE IF NOT EXISTS` however does not show an error, so I added that option


RE: DBForge should move to using ErrorException - Narf - 10-20-2016

It shows an error only with db_debug On, which is exactly what it should do.