>
> Perhaps this could be done in userland by throwing an exception in a
> user error_handler... did not test it though...
>
It seems that works! At least for E_WARNING:

class MyException extends Exception
{
 function __construct($errno, $errstr, $errfile, $errline)
 {
  parent::__construct($errstr, $errno);
  $this->file = $errfile;
  $this->line = $errline;
 }
}

function Error2Exception($errno, $errstr, $errfile, $errline)
{
 throw new MyException($errno, $errstr, $errfile, $errline);
}

$err_msg = 'no exception';
set_error_handler('Error2Exception');
try
{
 $con = pg_connect('host=localhost dbname=test');
}
catch (Exception $e)
{
 $err_msg = sprintf('%x - %s', $e->getCode(), $e->getMessage());
}


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to