Posted by Patrick Brunmayr on 10/03/07 20:20
On 3 Okt., 22:07, Mister Joe <mrjoefri...@gmail.com> wrote:
> I've tried searching w/ google and on php.net and still can't find a
> complete list off all exceptions that are predefined. I need a null
> object exception and don't want to write one if one already exists.
> Does anyone know where a comprehensive list is?
>
> Thanks
PHP has only on Exception class with can be used via
throw new Exception("Hi i am there");
all other Exception Classes MUST be derived from there. I think there
is no list of
exception because PHP mostly generates errors or warning. The
Exception feature is new!
If you need a "null object exception" the you must create it on your
own
class NullObjectException extends Exception
{
public function __construct(){
parent::__construct("an object has been noll where its not
allowed);
}
}
function MyFunc(){
throw new NullObjectException();
}
try
{
MyFunc();
}
catch(Exception $e)
{
if($e instanceof NullObjectException){
echo "YEAHH i am a NullObjectException";
}
}
I dont know if there's such a list you want to get. I developed some
basic exceptions for my own
like in .net!
Hope this helps ;)
Navigation:
[Reply to this message]
|