Re: List of Predefined PHP exceptions
am 03.10.2007 22:20:15 von Patrick Brunmayr
On 3 Okt., 22:07, Mister Joe 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 ;)
Re: List of Predefined PHP exceptions
am 03.10.2007 22:48:32 von zeldorblat
On Oct 3, 4:07 pm, Mister Joe 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
Re: List of Predefined PHP exceptions
am 03.10.2007 23:05:59 von Patrick Brunmayr
On 3 Okt., 22:48, ZeldorBlat wrote:
> On Oct 3, 4:07 pm, Mister Joe 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
>
>
thats nice ;)
But LogicException and RuntimeException are available since 5.1 while
the Core Exception class is there since 5.0! ;) No matter now they are
here ;)