PHP 5 Exception Handling

PHP Exception Error Handling uses try and catch

try & catch exceptions
try {something} catch() {catchit}

PHP errors are not PHP Exceptions
Note PHP try and catch does not catch errors unless you convert errors to exceptions first ! See PhpErrorException

example
try 
{
	pdfprocess();
}
catch (PDFlibException $e) 
{
	$msg ='PDFLIB' . PHP_EOL ;
	$msg .='code : '.$e->getCode() . PHP_EOL ;
	$msg .='file : '.$e->getFile() . 'line : '.$e->getLine() . PHP_EOL ;
	$msg .='mess : '.$e->getMessage() . PHP_EOL ;
	$msg .='detl : '.$e . PHP_EOL ;
	$msg .='PDFLIB';
} 
catch (Exception $e) 
{
	$msg = 'Exception' . PHP_EOL ;
	$msg .= 'code : '.$e->getCode() . PHP_EOL ;
	$msg .='file : '.$e->getFile() . 'line : '.$e->getLine() . PHP_EOL ;
	$msg .='mess : '.$e->getMessage() . PHP_EOL ;
	$msg .='detl : '.$eÊ. PHP_EOL ;
	$msg .='Exception';
}


REFERRERS
PhpErrorHandling
PhpFunctions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki