previousPackage PEAR_ErrorStack Constants (Previous) (Next) PEAR_Error::addUserInfo()next

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

PEAR_Error [veraltet]

Table of Contents

Ein Objekt der Klasse PEAR_Error wird von einer Methode in PEAR zurückgegeben, wenn ein Fehler auftritt. Es enthält Informationen über den aufgetretenen Fehler und erlaubt die Zurückverfolgung seiner Ursache.

Die Art und Weise, wie man das Objekt erhält, wird beeinflußt über die Methode PEAR::SetErrorHandling()

previousPackage PEAR_ErrorStack Constants (Previous) (Next) PEAR_Error::addUserInfo()next

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: anrdaemon@freemail.ru
Who want actual exceptions support to packages like MDB2, try this:

<?php
class ePearError extends Exception
{
  protected 
$_type;
  protected 
$_userInfo;

  function 
getType()
  {
    return 
$this->_type;
  }

  function 
getDebugInfo()
  {
    return 
$this->getUserInfo();
  }

  function 
getUserInfo()
  {
    return 
$this->_userInfo;
  }

  function 
__construct(&$errorObject)
  {
    
parent::__construct($errorObject->getMessage(), $errorObject->getCode());
    
$this->_type $errorObject->getType();
    
$this->_userInfo $errorObject->getUserInfo();
  }

  function 
__toString()
  {
    return 
sprintf('[%s: message="%s" code=%d info="%s"]'$this->getType(),
      
$this->getMessage(), $this->getCode(), $this->getUserInfo());
  }
}

function 
pearErrorCallback(&$errorObject)
{
  throw new 
ePearError($errorObject);
}

PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'pearErrorCallback');

?>