How can separate error handling be implemented in PHP, specifically when reading Excel files with PHPExcel?

When reading Excel files with PHPExcel, it's important to implement separate error handling to catch any potential issues that may arise during the file reading process. This can be done by using try-catch blocks to capture exceptions and handle them accordingly, ensuring that the script doesn't crash if an error occurs.

try {
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
    echo 'Error loading file: ',  $e->getMessage(), "\n";
    exit;
}