Catch error on $db->connect
Closed this issue · 4 comments
Revine-dev commented
I need to get an error if db connection fails.
But I can't catch any error on connection of database $db->connect
, I've tried TryCatch
statement and $db->connect(...) or die($db->error())
which doesn't work.
Even this solution returns an error :
https://stackoverflow.com/a/45950465/10723857
Fatal error: Uncaught mysqli_sql_exception: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
stefangabos commented
the error is shown in the debug console. or do you want to handle it differently?
Revine-dev commented
I need to get it either from an property or a method of $db
Revine-dev commented
Do you mind if I open a pull request to implement this feature ?
stefangabos commented
Please do.
I don't know if this helps otherwise