Hello Adam,
Wednesday, April 14, 2004, 12:58:36 AM, you wrote:
> On Wed, 14 Apr 2004, Marcus Boerger wrote:
>> > If the developer catches it, they handle it. If they don't, PHP
>> > catches it and issues a fatal error.
>>
>> I am not a friend of PHP catching exceptions and converting them to
>> E_ERRORs. Just have an uncaught exception message as we have now.
>> And no way of generous catching E_ERRORs by back-door.
> This is what I meant. An uncaught exception message is fatal right
> now.
> PHP Fatal error: Uncaught exception 'SQLiteException' with message
> 'SQLiteDatabase::__construct(): unable to open database: /sbin/foo'
> in Command line code:1
> Stack trace:
> #0 {main}
> thrown in Command line code on line 1
> This is actually a pretty nasty side effect of throwing exceptions in
> ctors because these two lines have *very* different results if they
> fail:
> $db = new SQLiteDatabase();
> $db = sqlite_open();
sqlite_open returns a resource and new SQLiteDatabase returns an object.
The latter is a ctor and to prevent it throwing exceptions you'd need to
provide a factory method, make the ctor private (which prevents inhering)
and then look ofr all possible kinds of failures before calling the ctor.
--
Best regards,
Marcus mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php