How to use the @bugsnag/core/lib/es-utils.includes function in @bugsnag/core

To help you get started, we’ve selected a few @bugsnag/core 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 / plugin-network-breadcrumbs / network-breadcrumbs.js View on Github external
function handleXHRError () {
  if (includes(getIgnoredUrls, this[REQUEST_URL_KEY])) {
    // don't leave a network breadcrumb from bugsnag notify calls
    return
  }
  // failed to contact server
  client.leaveBreadcrumb('XMLHttpRequest error', {
    request: `${this[REQUEST_METHOD_KEY]} ${this[REQUEST_URL_KEY]}`
  }, BREADCRUMB_TYPE)
}
github bugsnag / bugsnag-js / packages / plugin-network-breadcrumbs / network-breadcrumbs.js View on Github external
function handleXHRLoad () {
  if (includes(getIgnoredUrls(), this[REQUEST_URL_KEY])) {
    // don't leave a network breadcrumb from bugsnag notify calls
    return
  }
  const metadata = {
    status: this.status,
    request: `${this[REQUEST_METHOD_KEY]} ${this[REQUEST_URL_KEY]}`
  }
  if (this.status >= 400) {
    // contacted server but got an error response
    client.leaveBreadcrumb('XMLHttpRequest failed', metadata, BREADCRUMB_TYPE)
  } else {
    client.leaveBreadcrumb('XMLHttpRequest succeeded', metadata, BREADCRUMB_TYPE)
  }
}
github bugsnag / bugsnag-js / packages / plugin-network-breadcrumbs / network-breadcrumbs.js View on Github external
exports.init = (_client, _getIgnoredUrls = defaultIgnoredUrls, _win = window) => {
  if (!_client._config.enabledBreadcrumbTypes || !includes(_client._config.enabledBreadcrumbTypes, 'request')) return

  client = _client
  win = _win
  getIgnoredUrls = _getIgnoredUrls
  monkeyPatchXMLHttpRequest()
  monkeyPatchFetch()
}