Adding check for slave db; error catching when mysql connection fails