#NEWLINE# def continue_with( self , func ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# response = func ( ) #NEWLINE# #UNINDENT# except StopIteration as exception : #NEWLINE# #INDENT# if self . parent : #NEWLINE# #INDENT# self . parent . on_success ( exception . args ) #NEWLINE# #UNINDENT# #UNINDENT# except BaseException as exception : #NEWLINE# #INDENT# if isinstance ( exception , TaskFailed ) : #NEWLINE# #INDENT# exception . tasktrace . append ( self ) #NEWLINE# #UNINDENT# if self . parent : #NEWLINE# #INDENT# self . parent . on_error ( exception ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . register ( response )