From 701f8c67a2babe50955755706d701881fc128c19 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 4 Nov 2005 18:14:09 +0000 Subject: [PATCH] Adding error reporting structure --- api.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/api.php b/api.php index 12c2b24..f2df06a 100644 --- a/api.php +++ b/api.php @@ -146,6 +146,16 @@ class API $this->registry =& $registry; } + /** + * Constructs an error for the error handler to receive + * + * @param string Error message + */ + function error($message) + { + call_user_func(APIError(), $message); + } + /** * Sets a value, sanitizes it, and verifies it * @@ -396,6 +406,27 @@ class API } } +/** +* Setter and getter method for the API error reporting +* system. Passing a name will cause the set, no arguments +* will cause the get. +* +* @param mixed Method name in callable form +* +* @return mixed Method name in callable form +*/ +function APIError($new = null) +{ + static $caller; + + if ($new !== null) + { + $caller = $new; + } + + return $caller; +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ -- 2.43.5