The Right Approach to Exceptions

foobar foo at
Mon Feb 20 09:32:35 PST 2012

On Monday, 20 February 2012 at 17:12:17 UTC, Andrei Alexandrescu 
> On 2/20/12 11:08 AM, Mafi wrote:
>> If it's supposed to be simple factorization, then you should 
>> replace
>> "throw r" with "return r". Then the name of that function 
>> doesn't make
>> much sense anymore. But then you can better search for throw 
>> in user
>> code and the stack traces aren't obfuscated anymore.
>> throw createEx!AcmeException("....");
> I think that's a great idea, thanks.
> Andrei

I fail to see the point in this. Why is the above better than
throw AcmeException("....");

If you want to avoid boilerplate code in the definition of 
AcmeException, this can be better accomplished with a mixin.

More information about the Digitalmars-d mailing list