laravel try thiss or this code example
Example: try and catch laravel
try {
$this->buildXMLHeader();
} catch (\Exception $e) {
return $e->getMessage();
}
try {
$this->buildXMLHeader();
} catch (\Exception $e) {
return $e->getMessage();
}