The Right Approach to Exceptions

Jonathan M Davis jmdavisProg at
Sun Feb 19 15:28:50 PST 2012

On Sunday, February 19, 2012 18:48:02 address_is at invalid.invalid wrote:
> I guess "transient" is more descriptive.

Actually, thinking on it some more, I don't think that transient will work at 
all, and the reason is simple. _Which_ operation should you retry? You don't 
even necessarily know which function the exception came from out of the 
functions that you called within the try block - let alone which function 
actually threw the exception. Maybe it was thrown 3 functions deep from the 
function that you called, and while retrying that specific call 3 functions 
down might have made sense, retrying the function 3 functions up doesn't 
necessarily make sense at all.

Whether or not you can retry or retrying makes any sense at all is _highly_ 
dependent on who actually catches the exception. In many cases, it may be a 
function which could retry it, but in many it won't be, and so having the 
exception tell the caller that it could retry would just be misleading.

- Jonathan M Davis

More information about the Digitalmars-d mailing list