Build the full error stack
437011
function buildError(err, hackErr) {
  var stack1 = err.stack;
  var stack2 = hackErr.stack;
  var label = hackErr.label;

  var stack = [];

  stack1.split('\n').forEach(function(line, index, arr) {
    if (line.match(/^    at GeneratorFunctionPrototype.next/)) {
      stack = stack.concat(arr.slice(0, index));
      return;
    }
  });

  stack = stack.concat(stack2.split('\n').slice(2));
  if (!stack[0].match(/^Error:/)) {
    stack.unshift(err.message);
  }
  if (!!label) {
    stack.unshift('[DEBUG: ' + label + ']');
  }
  stack = stack.join('\n');

  var newError = new Error();
  newError.message = err.message;
  newError.stack = stack;

  return newError;
}
498421
function error(err) {
    if (!(err instanceof Error)) return err
    return {
        code: err.code,
        message: err.message,
        details: err.detail,
        stack: err.stack || ''
    }
}
1023274
function serializeError(err) {
  var o = {};

  Object.getOwnPropertyNames(err).forEach(function (k) {
    o[k] = err[k];
  });

  return _.omit(o, ['stack', 'type', 'arguments']);
}
858997
function makeEventError(error) {
  var stack = error.stack.split('\n');

  stack.splice(0, 1);
  stack.forEach(function(s, i) {
    stack[i] = s.trim();
  });

  return {
    type: typeName(error),
    error: error.message,
    stack: stack.filter(function(s) {
      return s;
    })
  };
}
1318223
function _parseErrors() {
    let errors = [].slice.call(arguments);
    let parsed = [];

    errors.forEach(err => {
        let message = (err instanceof Error) ? err.stack : err.toString();
        parsed.push(message);
    });

    return parsed;
}
80504
function ConfigStack(){
  this._stack = new Uint32Array( ( (LEN|0) * MIN_ALLOC)|0 );
  this._sets  = new Uint32Array( MIN_ALLOC|0 );
  this._tmpDat = new Uint32Array( LEN|0 );
  this._size  = MIN_ALLOC|0;
  this._ptr   = 0;

  this._headPos = 0;
  this._wcfg = new GLConfig();
}
379269
function sourceFromStacktrace() {
	try {
		throw new Error();
	} catch ( e ) {
		if (e.stacktrace) {
			// Opera
			return e.stacktrace.split("\n")[6];
		} else if (e.stack) {
			// Firefox, Chrome
			return e.stack.split("\n")[4];
		} else if (e.sourceURL) {
			// Safari, PhantomJS
			// TODO sourceURL points at the 'throw new Error' line above, useless
			//return e.sourceURL + ":" + e.line;
		}
	}
}
133296
private List<String> getStackTrace(Object error) {
        if (fullStack && error instanceof Throwable) {
            List<String> stackTrace = new ArrayList<>();
            for (StackTraceElement t : ((Throwable) error).getStackTrace()) {
                stackTrace.add(t.toString());
            }
            return stackTrace;
        } else {
            return Collections.emptyList();
        }
    }
978773
function prepareStackTrace(error, stack) {
  // Store source maps in a cache so we don't load them more than once when
  // formatting a single stack trace (don't cache them forever though in case
  // the files change on disk and the user wants to see the updated mapping)
  var cache = {};
  return error + stack.map(function(frame) {
    return '\n    at ' + wrapCallSite(cache, frame);
  }).join('');
}
997302
function showError(error) {
    console.error(logSymbols.error, "Error");
    console.error(`${error.message}\n`);
    console.error(logSymbols.error, "Stack trace");
    console.error(error.stack);
}
1086218
function createError(file, src, paths) {
	var err = ['Failed to find ' + file];

	if (src) {
		err.push('from ' + src);
	}

	err.push([
		'in [',
		'    ' + paths.join(',\n    '),
		']'
	].join('\n'));

	return err.join(' ');
}
552621
def handle_stack_error(e)
      case e.message
      when /is in ROLLBACK_COMPLETE state and can not be updated/
        puts "The #{@stack_name} stack is in #{"ROLLBACK_COMPLETE".color(:red)} and cannot be updated. Deleted the stack and try again."
        region = `aws configure get region`.strip rescue 'us-east-1'
        url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}"
        puts "Here's the CloudFormation console url: #{url}"
        exit 1
      when /No updates are to be performed/
        puts "There are no updates to be performed. Exiting.".color(:yellow)
        exit 1
      else
        raise
      end
    end
615603
def dump_error(error)
			error_message = [
				"#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} - " \
				"#{error.class} - #{error.message}:",
				*error.backtrace
			].join("\n\t")
			@env[Rack::RACK_ERRORS].puts(error_message)
		end
992072
function prepareStack(stack) {
	let lines = stack.split('\n').slice(1)

	if (lines.length > 500) {
		// Stack too big, probably this is caused by stack overflow
		// Remove middle values
		let skipped = lines.length - 500,
			top = lines.slice(0, 250),
			bottom = lines.slice(-250)
		lines = top.concat('--- skipped ' + skipped + ' frames ---', bottom)
	}

	return lines.map(line => line.trim().replace(/^at /, '').replace(basePath, '.'))
}
642626
function missingSemanticAction(ctorName, name, type, stack) {
  var stackTrace = stack.slice(0, -1).map(function(info) {
    var ans = '  ' + info[0].name + ' > ' + info[1];
    return info.length === 3
        ? ans + " for '" + info[2] + "'"
        : ans;
  }).join('\n');
  stackTrace += '\n  ' + name + ' > ' + ctorName;

  var where = type + " '" + name + "'";
  var message = "Missing semantic action for '" + ctorName + "' in " + where + '\n' +
                'Action stack (most recent call last):\n' + stackTrace;

  var e = createError(message);
  e.name = 'missingSemanticAction';
  return e;
}
414997
function buildErrorObject(error) {
		var msg = error.message || 'Unknown error occurred';
		var errorName = errorTypes.includes(error.name) ? error.name : 'Error';
		var ErrConstructor = window[errorName] || Error;

		if (error.stack) {
			msg += '\n' + error.stack.replace(error.message, '');
		}
		return new ErrConstructor(msg);
	}
459186
static function get_errors( $emask = null ) {
		$all = array();
		foreach( self::$stack as $type => $errs ){
			if( $emask === null || $type & $emask ) {
				foreach( $errs as $Err ){
					$all[] = $Err;
				}
			}
		}
		return $all;
	}