~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cleanup.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-12 12:55:36 UTC
  • mfrom: (5031.1.3 merge-2.1-into-devel)
  • Revision ID: pqm@pqm.ubuntu.com-20100212125536-75ekp8giqbsnunmu
(andrew) Merge lp:bzr/2.1 to lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
If you want to be certain that the first, and only the first, error is raised,
32
32
then use::
33
33
 
34
 
    operation = OperationWithCleanups(lambda operation: do_something())
 
34
    operation = OperationWithCleanups(do_something)
35
35
    operation.add_cleanup(cleanup_something)
36
 
    operation.run()
 
36
    operation.run_simple()
37
37
 
38
38
This is more inconvenient (because you need to make every try block a
39
39
function), but will ensure that the first error encountered is the one raised,