Hello
You can use try catch to do this, for example
try {
$config = array(
"host" => "192.168.0.11",
"dbname" => "blog",
"port" => 3306,
"username" => "sigma",
"password" => "secret"
);
return $connection = new \Phalcon\Db\Adapter\Pdo\Mysql($config);
}
catch(Exception $e) {
//dosomething
return false;
}