Change all remaining trigger_error() into throw new Exception()

This commit is contained in:
Ivan Lanin 2014-03-13 02:08:31 +07:00
parent d4d42752d4
commit 2f0438ff15
5 changed files with 13 additions and 13 deletions

View File

@ -133,7 +133,7 @@ class PHPWord_Section_Footer
$this->_elementCollection[] = $image; $this->_elementCollection[] = $image;
return $image; return $image;
} else { } else {
trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); throw new Exception('Src does not exist or invalid image type.');
} }
} }
@ -154,7 +154,7 @@ class PHPWord_Section_Footer
$this->_elementCollection[] = $memoryImage; $this->_elementCollection[] = $memoryImage;
return $memoryImage; return $memoryImage;
} else { } else {
trigger_error('Unsupported image type.'); throw new Exception('Unsupported image type.');
} }
} }

View File

@ -162,7 +162,7 @@ class PHPWord_Section_Header
$this->_elementCollection[] = $image; $this->_elementCollection[] = $image;
return $image; return $image;
} else { } else {
trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); throw new Exception('Src does not exist or invalid image type.');
} }
} }
@ -183,7 +183,7 @@ class PHPWord_Section_Header
$this->_elementCollection[] = $memoryImage; $this->_elementCollection[] = $memoryImage;
return $memoryImage; return $memoryImage;
} else { } else {
trigger_error('Unsupported image type.'); throw new Exception('Unsupported image type.');
} }
} }
@ -223,7 +223,7 @@ class PHPWord_Section_Header
$this->_elementCollection[] = $image; $this->_elementCollection[] = $image;
return $image; return $image;
} else { } else {
trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); throw new Exception('Src does not exist or invalid image type.');
} }
} }

View File

@ -140,7 +140,7 @@ class PHPWord_Section_Table_Cell
$this->_elementCollection[] = $link; $this->_elementCollection[] = $link;
return $link; return $link;
} else { } else {
trigger_error('Unsupported Link header / footer reference'); throw new Exception('Unsupported Link header / footer reference');
return false; return false;
} }
} }
@ -198,7 +198,7 @@ class PHPWord_Section_Table_Cell
$this->_elementCollection[] = $image; $this->_elementCollection[] = $image;
return $image; return $image;
} else { } else {
trigger_error('Source does not exist or unsupported image type.'); throw new Exception('Source does not exist or unsupported image type.');
} }
} }
@ -225,7 +225,7 @@ class PHPWord_Section_Table_Cell
$this->_elementCollection[] = $memoryImage; $this->_elementCollection[] = $memoryImage;
return $memoryImage; return $memoryImage;
} else { } else {
trigger_error('Unsupported image type.'); throw new Exception('Unsupported image type.');
} }
} }
@ -266,7 +266,7 @@ class PHPWord_Section_Table_Cell
$this->_elementCollection[] = $object; $this->_elementCollection[] = $object;
return $object; return $object;
} else { } else {
trigger_error('Source does not exist or unsupported object type.'); throw new Exception('Source does not exist or unsupported object type.');
} }
} }
@ -288,7 +288,7 @@ class PHPWord_Section_Table_Cell
$this->_elementCollection[] = $ptext; $this->_elementCollection[] = $ptext;
return $ptext; return $ptext;
} else { } else {
trigger_error('addPreserveText only supported in footer/header.'); throw new Exception('addPreserveText only supported in footer/header.');
} }
} }

View File

@ -127,7 +127,7 @@ class PHPWord_Section_TextRun
$this->_elementCollection[] = $image; $this->_elementCollection[] = $image;
return $image; return $image;
} else { } else {
trigger_error('Source does not exist or unsupported image type.'); throw new Exception('Source does not exist or unsupported image type.');
} }
} }

View File

@ -164,7 +164,7 @@ class PHPWord_Template
$rowStart = strrpos($this->_documentXML, "<w:tr>", ((strlen($this->_documentXML) - $offset) * -1)); $rowStart = strrpos($this->_documentXML, "<w:tr>", ((strlen($this->_documentXML) - $offset) * -1));
} }
if (!$rowStart) { if (!$rowStart) {
trigger_error("Can not find the start position of the row to clone."); throw new Exception("Can not find the start position of the row to clone.");
return false; return false;
} }
return $rowStart; return $rowStart;
@ -208,7 +208,7 @@ class PHPWord_Template
$tagPos = strpos($this->_documentXML, $search); $tagPos = strpos($this->_documentXML, $search);
if (!$tagPos) { if (!$tagPos) {
trigger_error("Can not clone row, template variable not found or variable contains markup."); throw new Exception("Can not clone row, template variable not found or variable contains markup.");
return false; return false;
} }