Re: Which Exception to use ....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 22, 2008 at 12:35 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:
> Pavel schreef:
>>
>> //sorry for my english
>>
>> Firstly, this list of exception show only registered in system exceptions,
>
> yes I know, I wrote exactly that in the first line of my post.
>
>> which (excluding one-two) are exceptions of some php
>> mobules:mysqli,sqllite and so on...
>
> it's 5 actually, I mentioned that also.
>
>> I use only Exception class and my extends on it (so and exceptions from
>> your list are extends...).
>
> yes, I know. they have to, it's an engine requirement, if you STW you can
> even find a class heirarchy diagram that documents them.
>
> the point is I'm writing a small site/app and I can't be arsed to
> write a stack of custom Exceptions and an autoloader etc because it's too
> much hassle for the simplistic nature of what I'm putting together
>
> ... so I figured I'd use built-in exceptions where I can because being
> able to differentiate certain 'types' of exception is quite handy, making
> everything a plain Exception is rather blunt (rather like doing surgery
> with a spoon).
>
> ... which is where my original question(s) come in. personally I find
> the built-ins rather useless unless you fancy being super pendantic with
> your exceptions (UnderflowException anyone?!?), seems the built-in
> exceptions
> don't really cover (m)any general situations.
>
> maybe a missing config file should be a RunTimeException ...
>
> still leaves the questions as to what a DomainException and a ErrorException
> is meant to model.
>

I have no idea on those two, but I can see use for things like
InvalidArgumentException, OutOfRangeException or the like in some
cases. In no case would I send something so low-level back to the
user, but they can be useful in input validation for functions to make
sure the data you are processing is what it should be.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux