How to catch exceptions?

Hi,
iā€™m writing my custom scheduler function where a PDO connection is made to retrieve some information.

Iā€™ve create, like usual, a try and catch block in order to catch exceptions but it wonā€™t works.

Any suggestion on this?

Regards

Even though this is a PHP question, we can try helpingā€¦ but we would have to see the code. Often the problem is just a small detail or even punctuationā€¦ it is only possible to see by reading the exact code.

Yesā€¦sure

Just for exampleā€¦a simple pdo connection to external database:

function importHubs(){
$GLOBALS[ā€˜logā€™]->FATAL(ā€™************************ Hubs Import START ***************ā€™);
$GLOBALS[ā€˜logā€™]->FATAL('
Connecting to DATAWAREHOUSE ā€™);
try{
$dsn = ā€œmysql:host=.;dbname=ā€;
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$PDOconn = new PDO($dsn, ā€œusernameā€ , ā€œpasswordā€, $options);
} catch (PDOException $e){
$GLOBALS[ā€˜logā€™]->FATAL('
OPS !!! NOT CONNECTED to DATAWAREHOUSE *************ā€™);
$GLOBALS[ā€˜logā€™]->FATAL($e->getMessage());
return false;
}

    //$PDOconn->query("bla bla bla");
    $GLOBALS['log']->FATAL('***************  WHAO !!!!! CONNECTED to DATAWAREHOUSE *************');
    return true;
}

This script for example does not generate any exception.

Using it outside SuiteCRM the exception was capturedā€¦

Any hint?

Regards

Sorryā€¦the example above seems to work.

Maybe some typo in my previous code.

This can be considered as solved.

really sorry