Re: Exceptions . . .

From: Malcolm Edgar (malcolm.edga..mail.com)
Date: Sat Aug 04 2007 - 05:28:57 EDT

  • Next message: Matt Kerr: "Re: handling of "0" dates...."

    I much prefer IllegalArguementException if it is an invalid method
    parameter or IllegalStateException if the object is in an invalid
    state for an method call.

    The reason I dont throw NPE is because the JRE will do that. When I
    see a NPE I generally think there may be a problem with the underlying
    code rather than the way I am using it.

    regards Malcolm Edgar

    On 8/4/07, Aristedes Maniatis <ar..aniatis.org> wrote:
    >
    > On 04/08/2007, at 2:41 AM, Mike Kienenberger wrote:
    >
    > > For what it's worth, when I write my own code these days, I use either
    > > NullPointerException("variable-name") or IllegalArgumentException("why
    > > it's illegal")
    >
    > I also use IllegalArgumentException quite a bit in my own code. And I
    > think it makes more sense to a user than a generic
    > CayenneRuntimeException. Plus you can use it to show some sort of
    > error dialog with a useful "you typed invalid search criteria" or
    > whatever.
    >
    > Ari
    >
    >
    > -------------------------->
    > Aristedes Maniatis
    > phone +61 2 9660 9700
    > PGP fingerprint 08 57 20 4B 80 69 59 E2 A9 BF 2D 48 C2 20 0C C8
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Aug 04 2007 - 05:29:31 EDT