How to use stack-generator - 4 common examples

To help you get started, we’ve selected a few stack-generator 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 bugsnag / bugsnag-js / packages / core / report.js View on Github external
BugsnagReport.getStacktrace = function (error, errorFramesToSkip = 0, generatedFramesToSkip = 0) {
  if (hasStack(error)) return ErrorStackParser.parse(error).slice(errorFramesToSkip)
  // in IE11 a new Error() doesn't have a stacktrace until you throw it, so try that here
  try {
    throw error
  } catch (e) {
    if (hasStack(e)) return ErrorStackParser.parse(error).slice(1 + generatedFramesToSkip)
    // error wasn't provided or didn't have a stacktrace so try to walk the callstack
    try {
      return filter(StackGenerator.backtrace(), frame =>
        (frame.functionName || '').indexOf('StackGenerator$$') === -1
      ).slice(1 + generatedFramesToSkip)
    } catch (e) {
      return []
    }
  }
}
github bugsnag / bugsnag-js / base / report.js View on Github external
BugsnagReport.getStacktrace = (error, errorFramesToSkip = 0, generatedFramesToSkip = 0) => {
  if (hasStack(error)) return ErrorStackParser.parse(error).slice(errorFramesToSkip)
  // error wasn't provided or didn't have a stacktrace so try to walk the callstack
  return filter(StackGenerator.backtrace(), frame =>
    (frame.functionName || '').indexOf('StackGenerator$$') === -1
  ).slice(1 + generatedFramesToSkip)
}
github opbeat / opbeat-react / src / exceptions / stacktrace.js View on Github external
generateArtificially: function StackTrace$$generateArtificially (opts) {
    opts = utils.mergeObject(defaultOptions, opts)

    var stackFrames = StackGenerator.backtrace(opts)
    if (typeof opts.filter === 'function') {
      stackFrames = stackFrames.filter(opts.filter)
    }

    return ErrorStackNormalizer(stackFrames)
  },
github opbeat / opbeat-react / src / exceptions / stacktrace.js View on Github external
generateArtificially: function StackTrace$$generateArtificially(opts) {
    opts = utils.mergeObject(defaultOptions, opts)

    var stackFrames = StackGenerator.backtrace(opts);
    if (typeof opts.filter === 'function') {
        stackFrames = stackFrames.filter(opts.filter);
    }
    return Promise.resolve(stackFrames);
  },

stack-generator

Generate artificial backtrace by walking arguments.callee.caller chain

MIT
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis

Popular stack-generator functions