Skip to content

Commit dded3a1

Browse files
committed
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.
1 parent 47461b1 commit dded3a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

MysqliDb.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ protected function _buildLimit ($numRows) {
11891189
protected function _prepareQuery()
11901190
{
11911191
if (!$stmt = $this->mysqli()->prepare($this->_query)) {
1192-
trigger_error("Problem preparing query ($this->_query) " . $this->mysqli()->error, E_USER_ERROR);
1192+
throw new Exception("Problem preparing query ($this->_query) " . $this->mysqli()->error);
11931193
}
11941194
if ($this->traceEnabled)
11951195
$this->traceStartQ = microtime (true);
@@ -1314,7 +1314,7 @@ public function interval ($diff, $func = "NOW()") {
13141314
if (!empty ($matches[2])) $items = $matches[2];
13151315
if (!empty ($matches[3])) $type = $matches[3];
13161316
if (!in_array($type, array_keys($types)))
1317-
trigger_error ("invalid interval type in '{$diff}'");
1317+
throw new Exception("invalid interval type in '{$diff}'");
13181318
$func .= " ".$incr ." interval ". $items ." ".$types[$type] . " ";
13191319
}
13201320
return $func;
@@ -1341,7 +1341,7 @@ public function now ($diff = null, $func = "NOW()") {
13411341
*/
13421342
public function inc($num = 1) {
13431343
if(!is_numeric($num)){
1344-
trigger_error('Argument supplied to inc must be a number', E_USER_ERROR);
1344+
throw new Exception('Argument supplied to inc must be a number');
13451345
}
13461346
return Array ("[I]" => "+" . $num);
13471347
}
@@ -1352,7 +1352,7 @@ public function inc($num = 1) {
13521352
*/
13531353
public function dec ($num = 1) {
13541354
if(!is_numeric($num)){
1355-
trigger_error('Argument supplied to dec must be a number', E_USER_ERROR);
1355+
throw new Exception('Argument supplied to dec must be a number');
13561356
}
13571357
return Array ("[I]" => "-" . $num);
13581358
}

0 commit comments

Comments
 (0)