Adding new geofence to monitor.
Geofence could override the previously one with the same id.

@name addOrUpdate
@param {Geofence|Array} geofences
@param {Function} success callback
@param {Function} error callback

@return {Promise}
358711
function (geofences, success, error) {
        if (!Array.isArray(geofences)) {
            geofences = [geofences];
        }

        geofences.forEach(coerceProperties);

        if (isIOS) {
            return addOrUpdateIOS(geofences, success, error);
        }

        return execPromise(success, error, "GeofencePlugin", "addOrUpdate", geofences);
    }
758322
function onPushNotificationError(error) {
    Q(pushCallback(error)).done(undefined, function (e) {
        diag.debug.assert(e === error, 'push callback failed: ' + e.message);
    });
}
852655
function (args, onDone, extra) {
		// if args are not provided then we shift the parameters
		if (typeof args === 'function') {
			extra = onDone;
			onDone = args;
			args = {};
		}

		// TODO: perform argument type check (currently there's none, so internal API calls won't do type checks)
		// TODO: move checker to here

		var onError = function(err) {
			LOG.error('onError '+ err, l_name);
			UTIL.safeCall(onDone, err);
		}

		function onExec() {
			// make actual call to user-defined function
			// NOTE: we also return values for direct function calls
			return UTIL.safeCall(l_list[name], args, function (err, result, unsupported_return) {
				if (err) {
					LOG.error('[' + name + '] error:', l_name);
					LOG.error(err, l_name);
				}

				if (unsupported_return) {
					var errmsg = 'onDone() in SR.API does not support more than one return variable, please return everything inside a result object';
					LOG.error(errmsg, l_name);
					LOG.stack();
					return UTIL.safeCall(onDone, errmsg);
				}

				// perform post-event actions, if any
				if (l_afterActions.hasOwnProperty(name) === false) {
					return UTIL.safeCall(onDone, err, result);
				}

				var posts = l_afterActions[name];
				var promise = undefined;
				for (var i=0; i < posts.length; i++) {
					if (!promise) {
						promise = post_action(args, { err: err, result: result }, posts[i], extra);
					} else {
						promise = promise.then(post_action(args, { err: err, result: result }, posts[i], extra));
					}
				}

				// last action
				promise.then(new SR.promise(function (resolve, reject) {
					//LOG.warn('everything is done... call original onDone...', l_name);
					UTIL.safeCall(onDone, err, result);
					resolve();
				}));

			}, extra);
		}

		// perform pre-event actions, if any
		if (l_beforeActions.hasOwnProperty(name) === false) {
			return onExec();
		}

		const pres = l_beforeActions[name].map((callback) => pre_action(args, callback, extra));
		pres.reduce((p, callback) => p.then(() => callback), Promise.resolve())
			.then(onExec)
			.catch((err) => {
				LOG.error(err);
				onDone(err);
			});
	}
199300
function (result) {
        if (result.success) {
          var txt = result.create ? 'added' : 'updated'
          console.log('The shield badge has been ' + txt + ' in your ' + that.readmeFilename + ' file')
        } else {
          console.log('Error while adding/updating the shield badge in your ' + that.readmeFilename + ' file: ' + result.error)
        }
      }
874563
def add_callbacks(self, future, callback, errback):
        
        def done(f):
            try:
                res = f.result()
                if callback:
                    callback(res)
            except Exception:
                if errback:
                    errback(create_failure())
        return future.add_done_callback(done)
504183
function postHookErrorHandler(err) {
                    /**
                     * Helper to add an error to an Object "errors" Symbol
                     */
                    const addError = (obj) => {
                        obj[ERR_KEY] = obj[ERR_KEY] || [];
                        obj[ERR_KEY].push(err);
                        return obj;
                    };

                    /**
                     * For response type that are *not* objects (string, integers, functions...)
                     * we convert the response to an object with a "result" property and set it as "override"
                     */
                    if (typeof response !== 'object') {
                        response = {
                            __override: {
                                result: response,
                            },
                        };
                    }

                    if ({}.hasOwnProperty.call(response, '__override')) {
                        response.__override = addError(response.__override);
                    } else {
                        response = addError(response);
                    }

                    return nextPostHook(response);
                }
1041401
function() {
        if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {
            this.map.addLayer(this.gratLayer);
            this.map.events.register('moveend', this, this.update);     
            this.update();
            return true;            
        } else {
            return false;
        }
    }
977918
function addCallback (t, data) {
  var result = data.result || data.error;
  cbid = data.id;
  if (t.callbacks[cbid]) {
    if (data.result) {
      t.callbacks[cbid](result);
    } else {
      t.callbacks[cbid](result, 'error');
    }
  }
}
65979
function(error) {
        if (connectError) {return;}
        if (error) {
          var err = {code:'CONNECT_ERROR', err: error};
          connectError = true;
          logger.error('start', err);
          return callback(err);
        }
        for (var name1 in t.monitors) {
          if (!t.monitors[name1].isConnected()) {
            return;
          }
        }
        t.set({started:true});
        t.connectListeners(true);
        callback();
      }
927564
function Error(message) {
  var error = new OriginalError(message)
  addNonEnumerableValue(error, '__trycatchcurrentStack__', trycatch.currentStack)
  return error
}
197002
function makeWrappedCallback(callback, frameLocation) {
        // add a fake stack frame. we can't get a real one since we aren't inside the original function
        var traceError = new Error();
        traceError.__location = frameLocation;
        traceError.__previous = currentTraceError;
        return function() {
            // if (currentTraceError) {
            //     FIXME: This shouldn't normally happen, but it often does. Do we actually need a stack instead?
            //     console.warn("(long-stack-traces) Internal Error: currentTrace already set.");
            // }
            // restore the trace
            currentTraceError = traceError;
            try {
                return callback.apply(this, arguments);
            } catch (e) {
                console.error("Uncaught " + e.stack);
                if (LST.rethrow)
                    throw ""; // TODO: throw the original error, or undefined?
            } finally {
                // clear the trace so we can check that none is set above.
                // TODO: could we remove this for slightly better performace?
                currentTraceError = null;
            }
        }
    }
472760
function (promise){
    		promise.success = function (fn) {
	            promise.then(fn);
	            return promise;
	        };

	        promise.error = function (fn) {
	            promise.then(null, fn);
	            return promise;
	        };
    	}
915560
function(success, error, opts) {
    var event = new CustomEvent(opts[0], { detail: opts[1] } );
    if( document.dispatchEvent( event ) ) success({});
  }
1206788
function StackTrace$$fromError(error, opts) {
            opts = _merge(_options, opts);
            var gps = new StackTraceGPS(opts);
            return new Promise(function(resolve) {
                var stackframes = _filtered(ErrorStackParser.parse(error), opts.filter);
                resolve(Promise.all(stackframes.map(function(sf) {
                    return new Promise(function(resolve) {
                        function resolveOriginal() {
                            resolve(sf);
                        }

                        gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);
                    });
                })));
            }.bind(this));
        }
4988
def on_success(self, fn, *args, **kwargs):
        

        self._callbacks.append((fn, args, kwargs))

        result = self._resulted_in
        if result is not _NOTHING_YET:
            self._succeed(result=result)
669655
@SuppressWarnings({"unused", "WeakerAccess"})
    public void pushError(final String errorMessage, final int errorCode) {
        final HashMap<String, Object> props = new HashMap<>();
        props.put("Error Message", errorMessage);
        props.put("Error Code", errorCode);

        try {
            final String activityName = getCurrentActivityName();
            if (activityName != null) {
                props.put("Location", activityName);
            } else {
                props.put("Location", "Unknown");
            }
        } catch (Throwable t) {
            // Ignore
            props.put("Location", "Unknown");
        }

        pushEvent("Error Occurred", props);
    }
646424
function(promises, callback) {
        function _checkComplete() {
            if (successfulPromises.length + failedPromises.length === count) {
                if (typeof callback === 'function') {
                    callback(successfulPromises, failedPromises);
                }
            }
        };

        var successfulPromises = [];
        var failedPromises = [];

        if (promises instanceof Array) {
            var count = promises.length;
            if(count === 0) {
                // There are no promises. Just resolve and return.
                _checkComplete();
                return;
            }

            promises.forEach(function(item) {
                // Register a callback to track all successful and failed 
                // promises.
                item.success(function() {
                    successfulPromises.push(item);
                    _checkComplete();
                });
                item.fail(function() {
                    failedPromises.push(item);
                    _checkComplete();
                });
            });
        } else {
            throw 'Invalid argument: promises. Must be an array';
        }
    }