How to handle db object errors

Permalink
Hello all ,

I am building a block for concrete5 and i am stuck at this issue :

$db = Loader::db($DB_SERVER_REMOTE,$DB_USERNAME_REMOTE,$DB_PASSWORD_REMOTE,$DB_DATABASE_REMOTE,true);

I want when this is not true to catch the error and display it properly and exit , otherwise continue !