Prev | Index | Next

Example of error handling 2

# def f():
#   try:
#     return foo()
#   finally:
#     cleanup()

def c(r):
    cleanup()
    return r

def f():
    return foo.addCallbacks(c, c)
    # or return foo.addBoth(c)