From: Hugo Villeneuve Date: Mon, 6 Jan 2014 16:50:02 +0000 (-0500) Subject: Add error checking when creating output file X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=d4744ed754637eae62f75e1616fdaae07b2e8e24;p=eda-utils.git Add error checking when creating output file --- diff --git a/bomgen/bomgen.php b/bomgen/bomgen.php index d38f116..d3055a5 100755 --- a/bomgen/bomgen.php +++ b/bomgen/bomgen.php @@ -219,6 +219,10 @@ $workbook = new Spreadsheet_Excel_Writer($dest); /* Création du worksheet */ $worksheet =& $workbook->addWorksheet($titre); +if (PEAR::isError($worksheet)) { + die($worksheet->getMessage()); +} + /* Importation du BOM CSV. */ $data = array(); $row_num = 1; @@ -416,4 +420,9 @@ xls_configure($workbook, $worksheet); $workbook->close(); +if (!file_exists($dest)) { + echo "Cannot create destination file: " . $dest . "\n"; + exit(1); +} + ?>