Re: Exceptions and Errors

From: Date: Tue, 13 Apr 2004 22:58:36 +0000
Subject: Re: Exceptions and Errors
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-9132@lists.php.net to get a copy of this message
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(); The first is fatal; the second isn't. -adam -- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!

« previous php.internals (#9132) next »