Common issue due to widespread teaching of try catch: echo $e->getMessage()
Safe methods:
1) Define environment testing: testing / production
Production setting:
1) Use logger class (that may mailer function to inform developers)
2) Issue generic error message
// Pseudo by Myo Soe, https://yehg.net
try{
....
} catch(Exception $e){
if ($this->env['debug'] == true){
echo $e->getMessage();
}else{
$logger->error($e->getMessage());
echo 'An error has ocurred';
}
}
Resource: