harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@pobox.com>
Subject Re: More helpful error messages
Date Mon, 27 Mar 2006 23:58:45 GMT


Thorbjørn Ravn Andersen wrote:
> Geir Magnusson Jr wrote:
> 
>>   if ( A || B ) {
>>      engineReset();
>>      throw new DigestException( A ?
>>                 "offset incorrect  = " + offset
>>                 : "incorrect len value ");
>> }
> 
> Please :)  That much trouble to avoid writing engineReset() twice?
> 
> if (A) {
>  resetEngine();
>  throw new DigestException("offset incorrect " + offset);
> }
> if (B) {
>  resetEngine();
>  throw new DigestException("incorrect len value " + lenValue);
> }
> 
> In my opinion ?: should only be used if there is a very good reason for 
> it, as it lowers readability for future maintainers.
> 


heh - I wasn't avoiding engineReset() - just really demonstrating that 
we should have an error message w/ data in it... :)

geir

Mime
View raw message