Re: exceptions instead of errors

From: Date: Mon, 05 May 2003 17:53:18 +0000
Subject: Re: exceptions instead of errors
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-1276@lists.php.net to get a copy of this message
Is "exception" class built in? if so, extendable by users?
There is a builtin exception class that can be inherited at C-level api. For now it is also inheritable inside PHP scripts but we may have two different types for internal and userland exceptions respectively or add another getter method to query that information.
if not, how does getMessage() know where to find the error - especially if this error is produced by an extension.
There is a dynamic property $message that can be set inside the constructor. Additional there are $code/getcode(), $file/getfile() and $line/getline(). However these properties are dynamically created upon instantiating when an internal exception is thrown or the exception::exception() constructor is called. So when inheriting the exception class simply ensure the base class constructor will be called. In the current implementation the above are not defined when inheriting the exception base class. But expect this to change so that these properties are declared in the base class as protected. marcus

« previous php.internals (#1276) next »