| core_lang

# Class: Bs_Exception Source Location: /core/lang/Bs_Exception.class.php
### Class Overview
    Bs_Object
       |
       --Bs_Exception
Emulate a Java exception, sort of... #### Author(s): Andrej Arn <at blueshoes dot org> #### Version: 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:17:48 $ #### Copyright: blueshoes.org | ### Variables $_globals | ### Methods Bs_Exception seedGlobals setStackParam stackDump stackTrace toString _varDump
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 17] Emulate a Java exception, sort of... no dependencies here. please try to avoid dependencies. #### Tags:
pattern: | singleton: (pseudostatic)
access: | public
version: | 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:17:48 $
copyright: | blueshoes.org
author: | Andrej Arn <at blueshoes dot org>
[ Top ] ### Class Variables #### $_globals = [line 86] Assotiative array with things we got from $GLOBALS. Holds the elements: ($globals['element']) postVars => an assotiative array holding the vars we got from an http post. getVars => an assotiative array holding the vars we got from an http get. cookieVars => an assotiative array holding the cookie vars. serverVars => an assotiative array holding the server vars. envVars => an assotiative array holding the environment vars. postFiles => something holding the post files. dunno. appVars => string of the dumped array $APP. THIS MIGHT BE A SECURITY HOLE IF PASSWORDS GET WRITTEN OR SENT TO SOMEWHERE!!! globalVars => assotiative array of all not-system-vars. globalArrays => assotiative array of all not-system-arrays. the values are dumped. globalObjects => assotiative array (key is the object name) holding strings of the dumped objects. THIS MIGHT BE A SECURITY HOLE IF PASSWORDS ARE IN AN OBJECT AND GET WRITTEN OR SENT TO SOMEWHERE!!! declaredClasses => an array holding the class names of all defined classes. only set if weight='fatal'. #### Tags:
private: |
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_Exception [line 103]
`void Bs_Exception( [string $message = ''], [string $file = ''], [int $line = ''], [string $errCode = NULL], [string $weight = ''])`
Constructor example: return new Bs_Exception('not a valid usDatetime specified', __FILE__, __LINE__); #### Tags:
access: | public
#### Parameters:
string | $message | an error message
string | $file | the file name (full path), use __FILE__
int | $line | the line number, use __LINE__
string | $errCode | a unique error code with text info: db:26:not connected
string | $weight | the weight of the exception (fatal?)
[ Top ] ### method seedGlobals [line 275]
`void seedGlobals( )`
Grabs all information we can about the current state of the php file. this includes: HTTP_POST_VARS, HTTP_GET_VARS, HTTP_COOKIE_VARS, HTTP_SERVER_VARS, HTTP_ENV_VARS, HTTP_POST_FILES, a string of all declared classes, a var_dump of our own settings array $APP, our own flat vars that are visible global, a var_dump of our own flat arrays that are visible global (without $APP), the Don't use this for fun! It's expensive! If it has already been done for this instance, we don't do it again but just ignore the request. #### Tags:
todo: | finish the code...
access: | public
[ Top ] ### method setStackParam [line 144]
`bool setStackParam( string $key, array $val)`
#### Tags:
return: | true on success, false if $key is not a known param. 'functionArgs' => array of vars that were passed to the function, get them with func_get_args(), see the example. 'vars' => associative array of some vars you want to pass along. 'objects' => array of some objects you want to pass along. note: if you want to pass the functionArgs, you cannot do it all in one line. it's not possible to use the function func_get_args() as function parameter :( see example. example for 'functionArgs': $funcArgs = func_get_args(); $success = $Obj->setStackParam('functionArgs', $funcArgs); example for 'vars': $success = $Obj->setStackParam('vars', array('myVar' => &$myVar)); example for 'objects': $success = $Obj->setStackParam('objects', array(&$this));
#### Parameters:
string | $key | can be one of 'functionArgs', 'vars', 'objects'
array | $val |
[ Top ] ### method stackDump [line 226]
`void stackDump( [string $what = ''])`
Dumps the stack to where you specify. param $what options: '' => Default. trigger a warning. 'log' => Log the exception. 'alert' => Email this alert to the ppl in the alert list and log the exception. 'echo' => Echo the exception to the screen. Use this only for debugging. please. 'die' => Echo the exception to the screen and die. Use this only for debugging. please. 'return' => Return the toHtml string of this exception. #### Tags:
todo: | finish the 'alert' case.
access: | public
#### Parameters:
string | $what | what you want to do. see text.
[ Top ] ### method stackTrace [line 204]
`void stackTrace( [string $message = ''], [string $file = ''], [int $line = ''], [string $weight = ''])`
#### Tags:
see: | Bs_Exception::Bs_Exception()
access: | public
#### Parameters:
string | $message | an error message
string | $file | the file name (full path), use __FILE__
int | $line | the line number, use __LINE__
string | $weight | the weight of the exception (fatal?)
[ Top ] ### method toString [line 347]
`string toString( )`
Prepares the stack to spit it out. #### Tags:
access: | public
Overrides Bs_Object::toString() (Dumps the content of this object to a string using PHP's var_dump().) [ Top ] ### method _varDump [line 424]
`void _varDump( mixed $param)`
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:08:58 +0100 by phpDocumentor 1.2.3