BlueShoes Application Framework made with PHP http://www.blueshoes.org/


Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: C:/usr/local/lib/php/blueshoes-4.2/core/lang/Bs_Exception.class.php
BlueShoes Application Framework - lang

Bs_Exception

Bs_Object
   |
  +-- Bs_Exception

Emulate a Java exception, sort of...

 

public class Bs_Exception extends Bs_Object

Emulate a Java exception, sort of...
no dependencies here. please try to avoid dependencies.

Authors
Version4.0.$id$
Copyrightblueshoes.org

 

Methods inherited from Bs_Object

isex, isexception, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean

Public Method Summary

void

Bs_Exception([ string $message, string $file, string $line, string $errCode, string $weight ])

Constructor
void

stackTrace([ string $message, string $file, string $line, string $weight ])

void

stackDump([ string $what ])

Dumps the stack to where you specify.
void

seedGlobals()

Grabs all information we can about the current state of the php file.
string

toString()

Prepares the stack to spit it out.Warning: documentation is missing.

Private Method Summary

bool

setStackParam(string $key, array $val)

array

_processParams(string $message, string $file, int $line)

gets called from the constructor and from stackTrace(). returns a useful aArray that will be added to $this->stack.
string

_toHtml()

Puts <pre></pre> around the string we grab from toString().
void

func_get_args(string $funcArgs, string $success, $funcArgs, string $success, &$myVar, &$myVar, &$myVar, string $success, &$this, &$this, $key, $key, $key, $key, $key, $key, $val, $val)

Warning: documentation is missing.
void

x(string $x)

Warning: documentation is missing.

Private Field Summary

unknown

$_Bs_String

I wanted to make this class completly independant. but toString() and seedGlobals() need $Bs_String->varDump().
unknown

$_weight

String indicating the exception weight.
int

$_errCode

The error code if one is set.
string

$_errText

The error text if one is set.
string

$_errType

Type of the error (if set). can be one of db, ...
unknown

$_stack

Array holding assotiative arrays of the params we get when an exception gets thrown or a stackTrace is done.
unknown

$_globals

Assotiative array with things we got from $GLOBALS.

Private Constant Summary

BS_EXCEPTION_VERSION >>4.0.$x$<< Warning: documentation is missing.

Public Method Details

Bs_Exception

public void Bs_Exception( [ string $message, string $file, string $line, string $errCode, string $weight ] )

  Constructor
example:return new Bs_Exception('not a valid usDatetime specified', __FILE__, __LINE__);

Parameter
string $message = >>''<<
an error message
string $file = >>''<<
the file name (full path), use __FILE__
string $line = >>''<<
the line number, use __LINE__
string $errCode = >>NULL,<<
a unique error code with text info: db:26:not connected
string $weight = >>''<<
the weight of the exception (fatal?)
Returns void


stackTrace

public void stackTrace( [ string $message, string $file, string $line, string $weight ] )

 

Parameter
string $message = >>''<<
an error message
string $file = >>''<<
the file name (full path), use __FILE__
string $line = >>''<<
the line number, use __LINE__
string $weight = >>''<<
the weight of the exception (fatal?)
Returns void

See Also Bs_Exception()

stackDump

public 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.

Parameter
string $what = >>''<<
what you want to do. see text.
Returns void


seedGlobals

public 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 varDump of our own settings array $APP, our own flat vars that are visible global,a varDump of our own flat arrays that are visible global (without $APP),theDon'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.

Returns void


toString

public string toString( )

  Prepares the stack to spit it out.

Warning: documentation is missing.

Returns string


Private Method Details

setStackParam

private bool setStackParam( string $key, array $val )

 

Parameter
string $key
can be one of 'functionArgs', 'vars', 'objects'
array $val
Returns bool

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));


_processParams

private array _processParams( string $message, string $file, int $line )

  gets called from the constructor and from stackTrace(). returns a useful aArray that will be added to $this->stack.

Parameter
string $message
an error message
string $file
int $line
Returns array

an associative array

See Also Bs_Exception(), stackTrace()

_toHtml

private string _toHtml( )

  Puts <pre></pre> around the string we grab from toString().

Returns string

See Also toString()

func_get_args

private void func_get_args( string $funcArgs, string $success, $funcArgs, string $success, &$myVar, &$myVar, &$myVar, string $success, &$this, &$this, $key, $key, $key, $key, $key, $key, $val, $val )

 

Warning: documentation is missing.

Parameter
string $funcArgs
Warning: documentation is missing.
string $success
Warning: documentation is missing.
$funcArgs
Warning: documentation is missing.
string $success
Warning: documentation is missing.
&$myVar
Warning: documentation is missing.
&$myVar
Warning: documentation is missing.
&$myVar
Warning: documentation is missing.
string $success
Warning: documentation is missing.
&$this
Warning: documentation is missing.
&$this
Warning: documentation is missing.
$key
Warning: documentation is missing.
$key
Warning: documentation is missing.
$key
Warning: documentation is missing.
$key
Warning: documentation is missing.
$key
Warning: documentation is missing.
$key
Warning: documentation is missing.
$val
Warning: documentation is missing.
$val
Warning: documentation is missing.
Returns void


x

private void x( string $x )

 

Warning: documentation is missing.

Parameter
string $x
Warning: documentation is missing.
Returns void


Private Field Details

$_Bs_String

private unknown $_Bs_String

>><<

I wanted to make this class completly independant. but toString() and seedGlobals() need $Bs_String->varDump().
@private


$_weight

private unknown $_weight

>><<

String indicating the exception weight.


$_errCode

private int $_errCode

>><<

The error code if one is set.


$_errText

private string $_errText

>><<

The error text if one is set.


$_errType

private string $_errType

>><<

Type of the error (if set). can be one of db, ...


$_stack

private unknown $_stack

>><<

Array holding assotiative arrays of the params we get when an exception gets thrown or a stackTrace is done.
Holds the elements: ($stack[x]['element'])$stack[0] is when the error gets thrown, [1] for the first addToStack, ...timestamp => a us-style datetime that is created in this classmessage => a string error messagefile => the full file name with pathline => the line number in the filefunctionArgs => an array holding the arguements which were passes to the function where the error occured.vars => an associative array holding vars that were passed by param.objects => an array holding copies of objects that were passed by param.


$_globals

private unknown $_globals

>><<

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'.if ($this->_weight == 'fatal') {$ret['declaredClasses'] = get_declared_classes();}@private


Private Constant Details

BS_EXCEPTION_VERSION

define( BS_EXCEPTION_VERSION, >>4.0.$x$<< )
Case: default: case sensitive




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta