====== proc retry {count body args} { for {set i 0} {$i < $count - 1} {incr i} { try { return [uplevel $body] } {*}$args } uplevel $body } ====== e.g.: ====== set response [aws_ec2 $ec2 RunInstances {*}$args] # Sometimes have to wait for the instance to be available for tagging... retry 3 { create_aws_ec2_tag $ec2 Name $name } trap InvalidInstanceID.NotFound {} { after 1000 } ====== ---- [AMG]: Some more explanation would be welcome. This code appears to retry an operation a specified number of times, swallowing configurable errors and other such abnormal returns all but the final time, though giving the user the ability to specify the handlers. Your example shows waiting one second between retries. Is this code intended to dodge a race condition? Maybe find another way to design your system such that the race doesn't exist.