def stopOnError(case, reactor, publisher=None):
 if (publisher is None):
  from twisted.python import log as publisher
 running = [None]
 def stopIfError(event):
  if (running and event.get('isError')):
   running.pop()
   reactor.stop()
 publisher.addObserver(stopIfError)
 case.addCleanup(publisher.removeObserver, stopIfError)

def stopOnError ( case , reactor , publisher = None ) : if ( publisher is None ) : from twisted . python import log as publisher running = [ None ] def stopIfError ( event ) : if ( running and event . get ( 'isError' ) ) : running . pop ( ) reactor . stop ( ) publisher . addObserver ( stopIfError ) case . addCleanup ( publisher . removeObserver , stopIfError )
stop the reactor as soon as any error is logged on the given publisher .