[Zope] Error Handling

Alex Verstraeten alex@quad.com.ar
Wed, 14 Mar 2001 06:17:55 -0300


Hey guys,

let's say I've got a dtml method which calls 4 other methods:
2 of these method inserts data into MySQL
the other 2 methods creates images using manage_addImage()

to have a nice consistency I need these 4 actions to perform sucessfully or
cancel the whole operation.

is there a better solution than doing this:

<dtml-try>
   <dtml-call method1>
<dtml-except>
   some html response
<dtml-else>
   <dtml-try>
       <dtml-call method2>
   <dtml-except>
      <dtml-call undo_method1>
   <dtml-else>
       <dtml-try>
           <dtml-call method3>
       <dtml-except>
           <dtml-call undo_method2>
           <dtml-call undo_method1>
       <dtml-else>
           <dtml-try>
                <dtml-call method4>
            <dtml-except>
                <dtml-call undo_method3>
                <dtml-call undo_method2>
                <dtml-call undo_method1>
            </dtml-try>
       </dtml-try>
   </dtml-try>
</dtml-try>


Thanks in advance!