Commit b3fc6f02 authored by Taddes Kroes's avatar Taddes Kroes

Added pQueryException for errors.

parent 31aaff40
...@@ -115,13 +115,9 @@ class pQuery { ...@@ -115,13 +115,9 @@ class pQuery {
*/ */
static function error($error /* , $arg1, $arg2... */) { static function error($error /* , $arg1, $arg2... */) {
$args = func_get_args(); $args = func_get_args();
$error = nl2br(call_user_func_array('sprintf', $args));
if( DEBUG ) { throw new pQueryException($error);
echo nl2br(call_user_func_array('sprintf', $args));
//echo debug_backtrace();
}
pQueryConfig::ERROR_IS_FATAL && exit;
} }
/** /**
...@@ -257,6 +253,13 @@ class pQuery { ...@@ -257,6 +253,13 @@ class pQuery {
} }
} }
/**
* Exception class for error throwing
*/
class pQueryException extends Exception {
}
/** /**
* Interface used for extending the jQuery class. * Interface used for extending the jQuery class.
*/ */
......
...@@ -39,10 +39,13 @@ class pQueryArrayTest extends UnitTestCase { ...@@ -39,10 +39,13 @@ class pQueryArrayTest extends UnitTestCase {
function test_reverse() { function test_reverse() {
$orginal = range(1, 4); $orginal = range(1, 4);
$reverse = range(4, 1, -1); $reverse = range(4, 1, -1);
$arr = _arr($orginal); $arr = _arr($orginal);
$this->assertEqual($arr->reverse()->variable, $reverse, 'reverse is not really reverse...'); $this->assertEqual($arr->reverse()->variable, $reverse, 'reverse is not really reverse...');
} }
function test_call() {
}
} }
?> ?>
\ No newline at end of file
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