if error clear all sessions otherwise check to see if all other sessions are complete
            then run the done callbacks
184250
def notify_done(self, error=False, run_done_callbacks=True):
        ''' 
        '''
        if error:
            for _session in self._sessions.values():
                _session.set_done()
            self._session_count = 0
        else:
            self._update_session_count(-1)
            for _session in self._sessions.values():
                if not _session.is_done():
                    return

        if run_done_callbacks:
            self._run_done_callbacks()
        self._done_event.set()
1017657
function complete(e) {
    clearTimeout(doneTimeout);
    if (!done) { return; }
    var d = done;
    done = null;
    if (e) {
      // test failure
      if (!(e instanceof Error)) {
        e = new Error(e);
      }
      d(e);
    } else {
      // test passed
      d();
    }
  }
930483
function onRequestError(error, result, endCallback) {
      result.currentRetries++;
      async.parallel([
        async.apply(recrawlError, error, result),
        async.apply(retrySameUrl,error, result)
      ],function(error){
          endCallback(error);
      });

  }
742210
function () {
				if (typeof global.onerror !== "undefined") {
					var self = this;
					global.onerror = function (msg, url, line) {
						self.error("[" + msg + " on line " + line + " of " + url + "]", 0);
					};
					return true;
				} else {
					return false;
				}
			}
699510
function run()
    {
        // Load Modules Within Event Execution Wrapper that can handle errors
        // with failure callable of event
        $self = $this; $modules = $this->modules_enabled;
        $this->event()->then(function() use ($self, $modules) {
            $self->moduleManager()->loadModules($modules);
        });

        // each error during execution of sapi event listeners must handled within sapi
        // handle errors when modules loaded successfully!
        $this->event()
            ->onFailure(function($exception, $event) {
                /** @var $event EventHeapOfSapi */
                $this->_run_handleException($exception, $event);
                $event->shutdown();
            })
            ->trigger(EventHeapOfSapi::EVENT_APP_BOOTSTRAP)
            ->trigger(EventHeapOfSapi::EVENT_APP_MATCH_REQUEST)
            ->trigger(EventHeapOfSapi::EVENT_APP_DISPATCH)
            ->trigger(EventHeapOfSapi::EVENT_APP_RENDER)
            ->trigger(EventHeapOfSapi::EVENT_APP_FINISH)
        ;
    }
974936
public void completeCallback(final Callback callback, final String error, final JsonNode result) {
        ObjectNode req = makeRequest("complete");
        req.put("cbid", callback.getCbid());
        req.put("err", error);
        req.set("result", result);

        this.runtime.requestResponse(req);
    }
1209755
function () {
    var self = this;
    if (! self.invalidated) {
      // if we're currently in _recompute(), don't enqueue
      // ourselves, since we'll rerun immediately anyway.
      if (! self._recomputing && ! self.stopped) {
        requireFlush();
        pendingComputations.push(this);
      }

      self.invalidated = true;

      // callbacks can't add callbacks, because
      // self.invalidated === true.
      for(var i = 0, f; f = self._onInvalidateCallbacks[i]; i++) {
        Deps.nonreactive(function () {
          callWithNoYieldsAllowed(f, self);
        });
      }
      self._onInvalidateCallbacks = [];
    }
  }
1237453
function(err, req, res, next) {

        function done(error) {
            log(req, util.format('middleware-end %s', name));
            next(error);
        }

        if (err && !errHandler) {
            log(req, util.format('skipped %s Hook is not for error handling', name));
            next(err);

        } else if (!err && errHandler) {
            log(req, util.format('skipped %s Hook is for error handling', name));
            next();

        } else {
            try {
                log(req, util.format('middleware-start %s', name));
                errHandler ? hook(err, req, res, done) : hook(req, res, done);
            } catch (err) {
                done(err);
            }

        }
    }
974104
function () {

    this._success = [];
    this._failed = [];
    this._cached = false;

    this._process = null;

    this._calls = 0;

    this._showProgress = true;
    this._showError = true;
    var _this = this;
    this.success = function () {
        _this.onSuccess.apply(_this, arguments);
    };

    this.error = function () {
        _this.onError.apply(_this, arguments);
    };
}
463028
function done() {
  	var storage = config.storage;

  	ProcessingQueue.finished = true;

  	var runtime = now() - config.started;
  	var passed = config.stats.all - config.stats.bad;

  	emit("runEnd", globalSuite.end(true));
  	runLoggingCallbacks("done", {
  		passed: passed,
  		failed: config.stats.bad,
  		total: config.stats.all,
  		runtime: runtime
  	});

  	// Clear own storage items if all tests passed
  	if (storage && config.stats.bad === 0) {
  		for (var i = storage.length - 1; i >= 0; i--) {
  			var key = storage.key(i);

  			if (key.indexOf("qunit-test-") === 0) {
  				storage.removeItem(key);
  			}
  		}
  	}
  }
430981
function(callback) {

      // Detect server errors
      var t = this, server = t.get('server');
      server.on('clientError', function(err){
        console.error('Client error detected on server', err);
        t.trigger('error', err);
      });
      server.on('close', function(err){
        server.hasEmittedClose = true;
        t.stop();
      });

      // Notify that we've started
      t.isListening = true;
      if (callback) {
        callback(null);
      }
      t.trigger('start');
    }
328827
protected void error(E error) {
    this.error = checkNotNull(error);
    this.completed = true;
    for (Callback<T, E> callback : toBeNotified) {
      callback.error(error);
    }
  }
1354873
function _each (result, callback, context, recordNum, resolve, reject) {
    // fetch more records
    result.fetch()
    // iterate over fetched records
    .then(records => {
        if (!records || !records.length) {
            return
        }
        // iterate over records
        return Promise.each(records, record => {
            // wait for callback to complete if it returns promise
            return callback(record, recordNum++, context)
        })
    })
    .then(() => {
        // resolve parent promise if done
        if (result.done) {
            resolve(context)
        }
        // iterate over more records if not all fetched
        else {
            _each(result, callback, context, recordNum, resolve, reject)
        }
    })
    // pass errors to parent promise
    .catch(reject)
}
958546
public function errorAllPendingCalls()
    {
        foreach ($this->calls as $call) {
            $call->getCallerSession()->sendMessage(ErrorMessage::createErrorMessageFromMessage($call->getCallMessage(), 'wamp.error.canceled'));
        }
    }
863864
function (event) {
                // Do nothing if the request has been cancelled.
                if (cancelled) {
                    return;
                }
                // Cleanup the page.
                cleanup();
                // Check whether the response callback has run.
                if (!finished) {
                    // It hasn't, something went wrong with the request. Return an error via
                    // the Observable error path. All JSONP errors have status 0.
                    observer.error(new HttpErrorResponse({
                        url: url,
                        status: 0,
                        statusText: 'JSONP Error',
                        error: new Error(JSONP_ERR_NO_CALLBACK),
                    }));
                    return;
                }
                // Success. body either contains the response body or null if none was
                // returned.
                observer.next(new HttpResponse({
                    body: body,
                    status: 200,
                    statusText: 'OK', url: url,
                }));
                // Complete the stream, the response is over.
                observer.complete();
            }
1315469
def on_error(self, ex):
        
        if self._d:
            self._d.errback()
            self._d = None
440282
function(err, result) {
      if (err && !util.isError(err)) {
        err = new Error(err);
      }
      if (callback) callback(err, result);
    }