PEAR..Errorhandling
| From: | Peter Valicek "- Snr. Cluster Engineer | Date: | Tue, 01 Jul 2003 16:51:03 +0000 |
| Subject: | PEAR..Errorhandling | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6365@lists.php.net to get a copy of this message | ||
Hello Experts,
just a little question on pear errorhandling.
Following code:
require_once 'PEAR.php';
class fruparser extends PEAR {
/*
* Constructor
*/
function fruparser ( $file ) {
/*
* Instance of PEAR
*/
$this->PEAR();
$this->hash = $this->uniqueID();
if ( is_file($file) && is_readable($file) ) {
$xml = join('', file($file));
$this->logging("Read $file to parser");
return $this->xmlfile = $xml;
} else {
return $this->errorHandler(1);
}
}
/*
* Error handler function
*/
function errorHandler ( $errno ) {
/*
* set error handler
*/
$this->setErrorHandling(PEAR_ERROR_DIE);
/*
* Array of Errormessages
*/
$errorcodes = array(
'1' => "Unable to open XML file"
);
$this->logging($errorcodes[$errno]);
return $this->raiseError($errorcodes[$errno], $errno);
}
<CODE END>
In case function fruparser funs in specified error should not only just
be printed "Unable to open XML file" from errorHandler function?
Should not $this->raiseError prevent the normal php error message unable
to open file?
Or does I have misunderstood soemthing.
Thanks in forward.
-Peter