You are here: Re: List of Predefined PHP exceptions « PHP Programming Language « IT news, forums, messages
Re: List of Predefined PHP exceptions

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация