v8 does not optimize functions with try-catch blocks, so we isolate them here to minimize the damage
557895
function decodeStr(s, decoder) {
  try {
    return decoder(s);
  } catch (e) {
    return QueryString.unescape(s, true);
  }
}
724007
function dig(obj) {
  var iterateeFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val, key, iterableParent) {
    return val;
  };
  // eslint-disable-line no-unused-vars
  // modifierFn = v => v,
  return (0, _each2.default)(obj, function iterator(itValue, key, itObj) {
    var processedItValue = itValue;
    // console.log("processedItValue (before)", processedItValue)
    if ((0, _is.isIterable)(itValue, { objects: true })) {
      // console.log("Is iterable, key:", key)
      processedItValue = (0, _each2.default)(itValue, iterator); // , iterateeFn
    }
    var iterateeReturnedValue = iterateeFn(processedItValue, key, itObj);
    // console.log("iterateeReturnedValue", iterateeReturnedValue)
    if ((0, _is.isObject)(iterateeReturnedValue) && (0, _is.isLength)((0, _toKeys2.default)(iterateeReturnedValue), 1) && (0, _get2.default)(iterateeReturnedValue, "$remove", false) === true) {
      return { $remove: true };
    } else if ((0, _is.isDefined)(iterateeReturnedValue)) {
      return iterateeReturnedValue;
    } else {
      // console.log("processedItValue (after)", processedItValue)
      return processedItValue;
    }
  }
  //,  iterateeFn
  );
}
136757
@Override
    public <OUT> IPromise<OUT> catchError(final Function<Object, IPromise<OUT>> function) {
        Promise res = new Promise<>();
        then( new Callback<T>() {
            @Override
            public void complete(T result, Object error) {
                if ( ! Actor.isError(error) ) {
                    res.complete(null, error);
                } else {
                    function.apply(error).then(res);
                }
            }
        });
        return res;
    }
1256749
function callAndCatchPromiseError(fn, ...args) {
  // args 最后一个参数如果是如果是 function 则表示 next()
  // 如果执行时出错，调用 next(err)
  const next = args[args.length - 1];
  let p = null;
  try {
    p = fn.apply(null, args);
  } catch (err) {
    return next(err);
  }
  if (p && p.then && p.catch) {
    p.catch(err => next(err));
  }
}
1294739
function tryCatchReject(f, x, thisArg, next) {
			try {
				next.become(getHandler(f.call(thisArg, x)));
			} catch(e) {
				next.become(new Rejected(e));
			}
		}
1158321
function(inNode) {
		var t, n = inNode;
		// FIXME: Mozilla: try/catch is here to squelch "Permission denied to access property xxx from a non-chrome context" 
		// which appears to happen for scrollbar nodes in particular. It's unclear why those nodes are valid targets if 
		// it is illegal to interrogate them. Would like to trap the bad nodes explicitly rather than using an exception block.
		try {
			while (n) {
				if (t = enyo.$[n.id]) {
					// there could be multiple nodes with this id, the relevant node for this event is n
					// we don't push this directly to t.node because sometimes we are just asking what
					// the target 'would be' (aka, calling findDispatchTarget from handleMouseOverOut)
					t.eventNode = n;
					break;
				}
				n = n.parentNode;
			}
		} catch(x) {
			console.log(x, n);
		}
		return t;
	}
912455
async function retryPromise(fn, attempts, backoff) {
    let aborted = false;

    try {
        const data = await fn(() => { aborted = true; });
        return data;
    }
    catch (e) {
        if (aborted || ((backoff.attempts + 1) >= attempts)) {
            throw e;
        }

        const duration = backoff.duration();
        debug(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e.message}`);

        await Promise.delay(duration);
        return retryPromise(fn, attempts, backoff);
    }
}
532096
function silentHttpError(code, data, message, e) {
    var stack;

    if (Type.isObject(e)) {
        if (e && e.message) {
            message = message + ', ' + e.message;
        }
        stack = e.stack;
        e = null;
    } else if (Type.isString(e)) {
        stack = e;
    } else {
        e = new Error();
        stack = e.stack;
    }

    return toString('SlientHttpError', core.trace(8, 9), message, stack, core.inspect(data), code);
}
299118
function (fn, scope) {
        return function () {
            try {
                return fn.apply(scope, arguments);
            }
            catch (ex) {
                logger.error(ex);
                logger.error(ex.stack);
                logger.log('error bubbled up ' + ex);
            }
        };
    }
894458
def anonymous_function(block)
      lambda do |*args|
        # args: (this, node) v8 >= 0.10, otherwise (node)
        raise ArgumentError, "missing node" if args.empty?
        @tree[:Anonymous].new block.call(@tree, args.last)
      end
    end
913856
function AggregateDestroyedError(msg, more) {
  // Pass the constructor to V8's
  // captureStackTrace to clean up the output
  Error.captureStackTrace(this, AggregateDestroyedError);

  // If defined, store a custom error message
  if (msg) {
    this.message = msg;
  }

  // If defined, store more infos
  if (more) {
    this.more = more;
  }
}
145519
function exitHandler(options, err) {
  if (err) {
    if (err.stack) {
      console.error(err.stack);
    } else {
      console.error(err.toString());
    }
  }
	if (whitelistedVulnerabilities.length > 0) {
        logger.info(colors.bold.yellow("Filtering the following vulnerabilities"));
        logger.info(colors.bold.yellow('=================================================='));
        for (var i = 0; i < whitelistedVulnerabilities.length; i++) {
        	var detail = whitelistedVulnerabilities[i];
          logger.info(`${colors.bold.blue(detail['title'])} affected versions: ${colors.red(detail['package'])} ${colors.red(detail['versions'])}`);
          logger.info(`${detail['description']}`);
          logger.info(colors.bold("ID") + ": " + detail.id);
          if (detail.whitelistedPaths) {
            detail.whitelistedPaths.forEach(function(path) {
              logger.info(colors.bold("Ignored Path") + ": " + path);
            })
          }
          logger.info(colors.bold.yellow('=================================================='));
        };
	}

  logger.info('');
  logger.info('Audited dependencies: ' + actualAudits +
            ', Vulnerable: ' + colors.bold.red(vulnerabilityCount) +
            ', Ignored: ' + whitelistedVulnerabilities.length);

    if(config.get('report')) {
        var filtered = whitelistedVulnerabilities.length;
        mkdirp('reports');
        if (JUnit[0] != '<') { // This is a hack in case this gets called twice
        	// Convert to XML
            JUnit = jsontoxml(JUnit);
        }
        var dom = new DOMParser().parseFromString(JUnit);
        dom.documentElement.setAttribute('name', `auditjs.security.${programPackage.split('.')[0]}`);
        dom.documentElement.setAttribute('errors', 0);
        dom.documentElement.setAttribute('tests', expectedAudits);
        dom.documentElement.setAttribute('package', 'test');
        dom.documentElement.setAttribute('id', '');
        dom.documentElement.setAttribute('skipped', filtered);
        dom.documentElement.setAttribute('failures', vulnerabilityCount);
        JUnit = new XMLSerializer().serializeToString(dom);
        logger.info( `Wrote JUnit report to reports/${output}`);
        fs.writeFileSync('reports/' + output, `<?xml version="1.0" encoding="UTF-8"?>\n${JUnit}`);
    }

    if (config.get('suppressExitError')) {
      process.exit(0);
    } else {
      process.exit(vulnerabilityCount);
    }
}
312703
static function optimize( $useComments, &$php, $tpl, &$tree, &$resourceData )
    {
        /* If for some reason we don't have elements, simply return */
        if (! is_array( $tree[1] ) )
            return;

        $addNodeInit = false;

        /* Loop through the children of the root */
        foreach ( $tree[1] as $key => $kiddie )
        {
            /* Analyse per node type */
            switch ( $kiddie[0] )
            {
                case eZTemplate::NODE_INTERNAL_OUTPUT_SPACING_INCREASE:
                case eZTemplate::NODE_INTERNAL_SPACING_DECREASE:
                    /* Removing unnecessary whitespace changes */
                    unset( $tree[1][$key] );
                    break;
                case 3: /* Variable */
                    if ( isset( $tree[1][$key + 1] ) and
                         ( $tree[1][$key + 1][0] == eZTemplate::NODE_INTERNAL_RESOURCE_ACQUISITION ) and
                         isset( $resourceData['class-info'] ) )
                    {
                        $ret = eZTemplateOptimizer::optimizeResourceAcquisition(
                            $useComments, $php, $tpl,
                            $tree[1][$key], $tree[1][$key + 1], $resourceData );
                        /* We only unset the tree node when the optimization
                         * function returns false, as that means that the
                         * optimization could not be made. */
                        if ($ret)
                        {
                            unset( $tree[1][$key] );
                        }
                    }
                    else
                    {
                        $ret = eZTemplateOptimizer::optimizeVariable( $useComments, $php, $tpl, $tree[1][$key][2], $resourceData );
                        if ( $ret & 1 )
                            $addNodeInit = true;
                    }
                    break;
            }
        }
        if ( $addNodeInit )
        {
            $initializer = array( eZTemplate::NODE_OPTIMIZED_INIT, null, false );
            array_unshift( $tree[1], $initializer );
        }
    }
402436
function( name, match, block ) {
		var self = this, result = { passed: false, extra: 'Block did not throw error' };

		// Variable arguments
		if ( block === undefined && munit.isFunction( match ) ) {
			block = match;
			match = undefined;
		}

		// Fail quick if block isn't a function
		if ( ! munit.isFunction( block ) ) {
			throw new Error( "Block passed to assert.throws is not a function: '" + block + "'" );
		}

		// test for throwing
		try {
			block();
		}
		catch ( e ) {
			result = self._errorMatch( e, match );
		}

		return self.ok( name, result.passed, self.throws, result.extra );
	}
156057
function optimizeNestedIifes(node) {
  var ok =
    matches({
      type: "ReturnStatement",
      argument: {
        type: "CallExpression",
        callee: {
          type: "FunctionExpression",
          body: {}
        }
      }
    })(node) &&
    get(node, "argument.arguments.length") === 0 &&
    get(node, "argument.callee.params.length") === 0 &&
    get(node, "argument.callee.body.body.length") === 1 &&
    get(node, "argument.callee.body.body[0].type") === "ReturnStatement";
  if (ok) {
    var kidNode = node.argument.callee.body.body[0];
    estraverse.replace(kidNode, {enter: optimizeNestedIifes});
    return kidNode;
  }
}
709344
function() {
  let args = Array.prototype.slice.call(arguments),
    ErrorClass = args[0];

  if (_.isObject(ErrorClass)) {
    args.shift();
  } else {
    ErrorClass = errors.RuntimeError;
  }

  args.unshift(null);   // the this arg for the .bind() call

  throw new (Function.prototype.bind.apply(ErrorClass, args));
}
363290
function rejectHandler(err) {
  process.stderr.write(`${err.stack || err}\n`);

  if (sh.config.fatal) {
    sh.exit(1);
  }

  return Promise.reject(err);
}