PEAR
[ class tree: PEAR ] [ index: PEAR ] [ all elements ]

Class: DB_Sqlite_Tools_Exception

Source Location: /DB_Sqlite_Tools-0.1.2/Tools/Exception.php

Class Overview

Exception
   |
   --DB_Sqlite_Tools_Exception

Base PEAR_Exception Class


Author(s):

Version:

  • $Rev:$

Variables

Methods


Inherited Variables

Class: Exception (Internal Class)

$code
$file
$line
$message
$previous
$string
$trace

Inherited Methods

Class: Exception (Internal Class)

constructor __construct ( [$message = ], [$code = ], [$previous = ] )
getCode ( )
getFile ( )
getLine ( )
getMessage ( )
getPrevious ( )
getTrace ( )
getTraceAsString ( )
__clone ( )
__toString ( )
__wakeup ( )

Class Details

[line 92]
Base PEAR_Exception Class

Features:

  • Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception))
  • Definable triggers, shot when exceptions occur
  • Pretty and informative error messages
  • Added more context info avaible (like class, method or cause)
Ideas:

  • Maybe a way to define a 'template' for the output
1) Inherited properties from PHP Exception Class:

protected $message protected $code protected $line protected $file private $trace

2) Inherited methods from PHP Exception Class:

__clone __construct getMessage getCode getFile getLine getTrace getTraceAsString __toString

3) Usage example

  1.   require_once 'PEAR/Exception.php';
  2.  
  3.   class Test {
  4.      function foo({
  5.          throw new PEAR_Exception('Error Message'ERROR_CODE);
  6.      }
  7.   }
  8.  
  9.   function myLogger($pear_exception{
  10.      echo $pear_exception->getMessage();
  11.   }
  12.   // each time a exception is thrown the 'myLogger' will be called
  13.   // (its use is completely optional)
  14.   PEAR_Exception::addObserver('mylogger''myLogger');
  15.   $test = new Test;
  16.   try {
  17.      $test->foo();
  18.   catch (PEAR_Exception $e{
  19.      print $e;
  20.   }



[ Top ]


Class Variables

$cause =

[line 94]

  • Access: protected

Type:   mixed


[ Top ]

$error_class =

[line 95]

  • Access: protected

Type:   mixed


[ Top ]

$error_method =

[line 96]

  • Access: protected

Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 108]

DB_Sqlite_Tools_Exception __construct( $message, [ $p2 = null], [ $p3 = null])

Supported signatures:

PEAR_Exception(string $message); PEAR_Exception(string $message, int $code); PEAR_Exception(string $message, Exception $cause); PEAR_Exception(string $message, Exception $cause, int $code);

  • Access: public

Overrides Exception::constructor __construct ( [$message = ], [$code = ], [$previous = ] ) (parent method not documented)

Parameters:

   $message   — 
   $p2   — 
   $p3   — 

[ Top ]

addObserver   [line 130]

void addObserver( $label, $callback)

  • Access: public

Parameters:

   $label   — 
   $callback   — 

[ Top ]

delObserver   [line 135]

void delObserver( $label)

  • Access: public

Parameters:

   $label   — 

[ Top ]

getCause   [line 179]

Exception_object getCause( )

  • Return: The context of the exception
  • Access: public

[ Top ]

getCauseMessage   [line 167]

void getCauseMessage( $obj)

  • Access: public

Parameters:

   $obj   — 

[ Top ]

getErrorClass   [line 184]

void getErrorClass( )

  • Access: public

[ Top ]

getErrorMethod   [line 189]

void getErrorMethod( )

  • Access: public

[ Top ]

__toString   [line 194]

void __toString( )

  • Access: public

Overrides Exception::__toString ( ) (parent method not documented)
[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:55:48 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.