Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Doubt about Exceptions

posted by jmtucu 8 years ago

Hi! I've a question, it's this code right?

try
{
  $db  = new fDatabase('mysql', 'database', 'root', 'pass', 'localhost');
}
catch(fConnectivityException $e)
{
  echo $e->printMessage();
}

I'm getting the message Fatal error: Uncaught exception 'fConnectivityException' with message 'Unable to connect to database' in ... but the try/catch it's used... What's wrong?

Thanks!

@jmtucu

fDatabase connects in a lazy fashion, so it won't through the connectivity exception until you try and run a query. I have the intention of making the connect method public so you can explicitly ask for the connection to be made, but I haven't done that yet.

posted by wbond 8 years ago

Great! Thanks Will, you rock! ;)

posted by jmtucu 8 years ago