Menu

ERROR Log in to Edit

LongStone

ERROR Object

the error object takes (up to) 3 values in the constructor arguments array: code, message, data.
When calling the "getError" method will return an array consisting of the arguments and their set values. calling "getError" with $args["obj"] = TRUE; (boolean) will return an object with the named values as used in the constructor.

$args = array();
$args["code"]       = 'the code'; //code message data
$args["message"]    = 'the message';
$args["data"]       = 'the data';
$ERROR = new ERROR($args);
echo '@'.__LINE__.':ERROR1<pre>'.var_export($ERROR1, true).'</pre><br>';
unset($args);
$args = null;
$ERROR1 = $ERROR->getError($args);
echo '@'.__LINE__.':ERROR1<pre>'.var_export($ERROR1, true).'</pre><br>';

results in:

array (
    'code' => 'the code',
    'message' => 'the message',
    'data' => 'the data',
);

$args = array();
$args["obj"]        = TRUE;
$ERROR2 = $ERROR->getError($args);
echo '@'.__LINE__.':ERROR2<pre>'.var_export($ERROR2, true).'</pre><br>';

results in:

stdClass :: _set_state(array(
   'code' => 'the code',
   'message' => 'the message',
   'data' => 'the data',
));

Related

Wiki: Application Structure

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.