Commit dded3a1d authored by Dave Swift's avatar Dave Swift

Swapped trigger_error for exceptions

It seems more convenient/conventional to throw exceptions so they can be
caught, if desired.  Using trigger_error creates a fatal error.
parent 47461b15
...@@ -1189,7 +1189,7 @@ class MysqliDb ...@@ -1189,7 +1189,7 @@ class MysqliDb
protected function _prepareQuery() protected function _prepareQuery()
{ {
if (!$stmt = $this->mysqli()->prepare($this->_query)) { if (!$stmt = $this->mysqli()->prepare($this->_query)) {
trigger_error("Problem preparing query ($this->_query) " . $this->mysqli()->error, E_USER_ERROR); throw new Exception("Problem preparing query ($this->_query) " . $this->mysqli()->error);
} }
if ($this->traceEnabled) if ($this->traceEnabled)
$this->traceStartQ = microtime (true); $this->traceStartQ = microtime (true);
...@@ -1314,7 +1314,7 @@ class MysqliDb ...@@ -1314,7 +1314,7 @@ class MysqliDb
if (!empty ($matches[2])) $items = $matches[2]; if (!empty ($matches[2])) $items = $matches[2];
if (!empty ($matches[3])) $type = $matches[3]; if (!empty ($matches[3])) $type = $matches[3];
if (!in_array($type, array_keys($types))) if (!in_array($type, array_keys($types)))
trigger_error ("invalid interval type in '{$diff}'"); throw new Exception("invalid interval type in '{$diff}'");
$func .= " ".$incr ." interval ". $items ." ".$types[$type] . " "; $func .= " ".$incr ." interval ". $items ." ".$types[$type] . " ";
} }
return $func; return $func;
...@@ -1341,7 +1341,7 @@ class MysqliDb ...@@ -1341,7 +1341,7 @@ class MysqliDb
*/ */
public function inc($num = 1) { public function inc($num = 1) {
if(!is_numeric($num)){ if(!is_numeric($num)){
trigger_error('Argument supplied to inc must be a number', E_USER_ERROR); throw new Exception('Argument supplied to inc must be a number');
} }
return Array ("[I]" => "+" . $num); return Array ("[I]" => "+" . $num);
} }
...@@ -1352,7 +1352,7 @@ class MysqliDb ...@@ -1352,7 +1352,7 @@ class MysqliDb
*/ */
public function dec ($num = 1) { public function dec ($num = 1) {
if(!is_numeric($num)){ if(!is_numeric($num)){
trigger_error('Argument supplied to dec must be a number', E_USER_ERROR); throw new Exception('Argument supplied to dec must be a number');
} }
return Array ("[I]" => "-" . $num); return Array ("[I]" => "-" . $num);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment