Forum OpenACS Development: Re: Problem in incoming email reply handling

Collapse
Posted by Tom Jackson on

If the delete causes an error, you have the same effect: on next cycle, the delete will cause an error outside of catch and the rest of the replies will go unprocessed. The problem is you don't know which of the three statements in the catch will cause the error. The bug is putting too much in one catch so that you have no easy way to figure out how to respond to the error.

One idea is to do each statement in an if catch, deciding what to do if you get an error. Undo the damage, log the error, and use [continue] to keep on going, skipping the remaining statements in the loop:

 if {[catch {
      notification::type::process_reply -type_id $type_id -reply_id $reply_id
 } err]} {
      carefully_undo_process_reply_error
      log Error "process_reply failed..."
      continue
 } 
 ...