The Right Approach to Exceptions

deadalnix deadalnix at gmail.com
Wed Feb 22 12:42:22 PST 2012


Le 22/02/2012 18:50, H. S. Teoh a écrit :
> On Wed, Feb 22, 2012 at 11:53:39AM +0100, deadalnix wrote:
> [...]
>> Additionnaly, I would mention that the transient isn't a caracteristic
>> of the Exception, but of the recovery strategy.
>
> Technically correct. Though I'm playing with the idea of making recovery
> strategies a property of an exception - since a recovery strategy is
> meaningless without an associated exception (or problem). I need to
> think this through a bit more, though, as to how to correctly implement
> this.
>

I did though about this. This isn't the right way. Recovery strategy 
doesn't have any meaning at the catch point, so we shouldn't make it a 
property of Exception.

And sometime you don't care about the Exception. If you try to connect 
something that is know to fail for exemple, you really don't want to 
know what went wrong. You just want to try again with some backoff.

I do think you made a point with the handler getting an Exception and a 
recovery stratgy as parameter, but it is still unclear where all this 
goes to me.


More information about the Digitalmars-d mailing list