[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Informative throws
From: |
Stuart Ballard |
Subject: |
Re: Informative throws |
Date: |
Thu, 26 Jul 2001 14:30:24 -0400 |
Tom Tromey wrote:
>
> Eric> if (str == null || (len = str.length()) == 0)
> Eric> if (Configuration.EXCEPTION_MESSAGES)
> Eric> throw new NumberFormatException("string null or empty");
> Eric> else
> Eric> throw new NumberFormatException();
>
> My concerns with this approach are maintainability and readability. I
> wish it were easily possible to do this via some sort of preprocessing
> step.
There's always:
throw Configuration.EXCEPTION_MESSAGES ?
new NumberFormatException("string null or empty") :
new NumberFormatException();
This is, I think, slightly more readable - although I've always been a
fan of the ternary operator, so I'm biased perhaps.
Stuart.
- Informative throws, Eric Blake, 2001/07/26
- Re: Informative throws, Tom Tromey, 2001/07/26
- Re: Informative throws, Tom Tromey, 2001/07/27
- RE: Informative throws, Eric Blake, 2001/07/30
- Re: Informative throws, Tom Tromey, 2001/07/30