How to use the error-stack-parser.parseFFOrSafari function in error-stack-parser

To help you get started, we’ve selected a few error-stack-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iodide-project / iodide / src / reps / serialization / get-error-stack-summary.js View on Github external
const fileName =
      ["eval", ""].indexOf(locationParts[0]) > -1
        ? undefined
        : locationParts[0];

    return new StackFrame({
      functionName,
      fileName,
      lineNumber: locationParts[1],
      columnNumber: locationParts[2],
      source: line
    });
  }, ErrorStackParser);
};

ErrorStackParser.parseFFOrSafari = error => {
  const filtered = error.stack
    .split("\n")
    .filter(
      line => !line.match(/^(eval@)?(\[native code\])?$/),
      ErrorStackParser
    );

  return filtered.map(line => {
    const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
    const matches = line.match(functionNameRegex);
    const functionName = matches && matches[1] ? matches[1] : undefined;

    if (line.indexOf(" > eval") > -1) {
      const regExp = / > (eval:\d+:\d+)$/;
      const evalParts = regExp.exec(line);
      if (evalParts) {

error-stack-parser

Extract meaning from JS Errors

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis