Intercept errors thrown by `fn()`, extending them with information from `key`
@rtype (key: String, fn: Function) => Any
@param {String} key - Information to attach
@param {Function} fn - Thunk
@return {Any} Execution result
325474
function extendingErrorPath (key, fn) {
  try {
    return fn()
  } catch (e) {
    throw Object.assign(e, { path: [key].concat(e.path || []) })
  }
}
685422
function tryFn(fn, args) {
  try {
    return Promise.resolve(fn.apply(null, args));
  } catch (e) {
    return Promise.reject(e);
  }
}
560156
function applyKey (fn, key) {
    return function (obj) {
      if (key in obj) {
        obj[key] = fn(obj[key])
      }

      return obj
    }
  }
104310
function removeErrorRecovery (fn) {
    var parseFn = String(fn);
    try {
        var JSONSelect = require("JSONSelect");
        var Reflect = require("reflect");
        var ast = Reflect.parse(parseFn);

        var labeled = JSONSelect.match(':has(:root > .label > .name:val("_handle_error"))', ast);
        labeled[0].body.consequent.body = [labeled[0].body.consequent.body[0], labeled[0].body.consequent.body[1]];

        return Reflect.stringify(ast).replace(/_handle_error:\s?/,"").replace(/\\\\n/g,"\\n");
    } catch (e) {
        return parseFn;
    }
}
438050
function getError(errno, app) {
	let errObj = {
		errno: errno,
		message: errors[errno].replace('$app', app)
	};
	return errObj.message;
}
713433
function(key, fn) {
    var self = this;
    var filepath = this._makeFilepath(key);

    fs.exists(filepath, function(exists) {
      if (!exists) {
        return fn();
      }

      fs.readFile(filepath, 'UTF8', function(err, data) {
        if (err) {
          return fn(err);
        }

        var cache = JSON.parse(data);

        if (!self._cacheIsValid(cache)) {
          return self.del(key, fn);
        }
        fn(null, cache.data);
      });

    });
  }
95457
function required (key) {
  if (missing(key)) {
    throw new ReferenceError(format(REQUIRED_ERROR, key))
  } else {
    return get(key)
  }
}
810264
function any(obj) {
  var ctx = this;

  if (typeof obj === 'function') {
    obj = slice.call(arguments);
  }

  return function(done) {
    var keys = Object.keys(obj);
    var isArray = Array.isArray(obj);
    var finished;

    function getkey(key) {
      return isArray ? Number(key) : key;
    }

    if (!keys.length) {
      setImmediate(function() {
        done(null, null);
      });
      return;
    }

    for (var i = 0; i < keys.length; i++) {
      run(obj[keys[i]], keys[i]);
    }

    function run(fn, key) {
      if (finished) return;
      try {
        fn = toThunk(fn, ctx);
        if (typeof fn !== 'function') {
          done(new Error('co.any only accept yieldables'));
        }
        fn.call(ctx, function(err, res) {
          if (finished) return;
          finished = true;
          if (err) {
            err._key = getkey(key);
            return done(err);
          }
          done(null, {
            _key: getkey(key),
            value: res
          });
        });
      } catch (err) {
        finished = true;
        err._key = getkey(key);
        done(err);
      }
    }
  }
}
232575
function VError(options)
{
	var args, causedBy, ctor, tailmsg;

	if (options instanceof Error || typeof (options) === 'object') {
		args = Array.prototype.slice.call(arguments, 1);
	} else {
		args = Array.prototype.slice.call(arguments, 0);
		options = undefined;
	}

	tailmsg = args.length > 0 ?
	    mod_extsprintf.sprintf.apply(null, args) : '';
	this.jse_shortmsg = tailmsg;
	this.jse_summary = tailmsg;

	if (options) {
		causedBy = options.cause;

		if (!causedBy || !(options.cause instanceof Error))
			causedBy = options;

		if (causedBy && (causedBy instanceof Error)) {
			this.jse_cause = causedBy;
			this.jse_summary += ': ' + causedBy.message;
		}
	}

	this.message = this.jse_summary;
	Error.call(this, this.jse_summary);

	if (Error.captureStackTrace) {
		ctor = options ? options.constructorOpt : undefined;
		ctor = ctor || arguments.callee;
		Error.captureStackTrace(this, ctor);
	}
}
842088
function PreconditionError(message, caller) {
  this.name = 'PreconditionError';
  this.message = message || 'Precondition failed';
  if (typeof Error.captureStackTrace === 'function') {
    Error.captureStackTrace(this, caller || PreconditionError);
  }
}
281224
function tryFn1 (fn, arg, err) {
  try {
    err.err = null
    return fn(arg)
  } catch (e) {
    err.err = e
  }
}
1319420
function thunkify(input, ctx, key) {
    return function() {        
        ctx = ctx || this;
        
        var args = [];
        for (var i = 0; i < arguments.length; ++i) {
            args.push(arguments[i]);
        }

        return function(done) {
            var called;
            args.push(function() {
                if (!called) {
                    called = true;
                    done.apply(null, arguments);
                }
            });
            try {
                input.apply(ctx, args);
            } catch (err) {
                done(err);
            }
        };
    };
}
738676
function detectCustomErrorMessage(key) {
            if (typeof properties[key] === 'object' && properties[key].errorMessage && properties[key].value) {
                return properties[key];
            }
            else  if (_.isArray(properties[key])) {
                return {
                    value: properties[key][0],
                    errorMessage: properties[key][1]
                };
            }
            else {
                return {
                    value: properties[key],
                    errorMessage: undefined
                };
            }
        }
339218
function (key, callback) {
            return client.get(key, function (err, result) {
                return callback(err, result);
            });
        }
1228937
function(fn, context){
      var cursor = this;
      while (cursor = cursor.handler)
        if (cursor.fn === fn && cursor.context === context)
          console.warn('duplicate fn & context pair');

      this.handler = {
        fn: fn,
        context: context,
        handler: this.handler
      };
    }
912908
function WError(options)
{
	Error.call(this);

	var args, cause, ctor;
	if (typeof (options) === 'object') {
		args = Array.prototype.slice.call(arguments, 1);
	} else {
		args = Array.prototype.slice.call(arguments, 0);
		options = undefined;
	}

	if (args.length > 0) {
		this.message = mod_extsprintf.sprintf.apply(null, args);
	} else {
		this.message = '';
	}

	if (options) {
		if (options instanceof Error) {
			cause = options;
		} else {
			cause = options.cause;
			ctor = options.constructorOpt;
		}
	}

	Error.captureStackTrace(this, ctor || this.constructor);
	if (cause)
		this.cause(cause);

}
195178
function ErrorStackParser$$parseOpera11(error) {
	            var filtered = _filter(error.stack.split('\n'), function (line) {
	                return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
	                    !line.match(/^Error created at/);
	            }, this);
	
	            return _map(filtered, function (line) {
	                var tokens = line.split('@');
	                var locationParts = this.extractLocation(tokens.pop());
	                var functionCall = (tokens.shift() || '');
	                var functionName = functionCall
	                        .replace(/<anonymous function(: (\w+))?>/, '$2')
	                        .replace(/\([^\)]*\)/g, '') || undefined;
	                var argsRaw;
	                if (functionCall.match(/\(([^\)]*)\)/)) {
	                    argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1');
	                }
	                var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(',');
	                return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2], line);
	            }, this);
	        }