views:

23

answers:

1

Do any languages that support retry constructs in exception handling track and expose the number of times their catch/rescue (and/or try/begin) blocks have been executed in a particular run?

I find myself counting (and limiting) the number of times a code block is re-executed after an exception often enough that this would be a handy language built-in.

+1  A: 

This is a really interesting question. I did a little research and apparently there is a design pattern called the circuit breaker pattern which was developed to handle such things. I have never heard of the pattern before and can't find much information about it.

There is a library which handles retrying an event for .NET available, might be worth a look. Heres a link to an article about it:

http://www.tobinharris.com/past/2009/1/26/net-circuit-breakers/

evolve
+1 for the suggestion, thanks!
pilcrow