How to use the raven.mergeContext function in raven

To help you get started, we’ve selected a few raven 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 Foundry376 / Mailspring / app / src / error-logger-extensions / raven-error-reporter.js View on Github external
_setupSentry() {
    Raven.disableConsoleAlerts();
    Raven.config(
      'https://18d04acdd03b4389a36ef7d1d39f8025:5cb2e99bd3634856bfb3711461201439@sentry.io/196829',
      {
        name: this.deviceHash,
        release: this.getVersion(),
      }
    ).install();

    // Just give us something random that we can use to tell how many users are impacted
    // by each bug. This is important because sometimes one user will hit an exception 1,000
    // times and skew the Sentry data.
    Raven.mergeContext({
      user: {
        id: this.deviceHash,
      },
    });

    Raven.on('error', e => {
      console.log(`Raven: ${e.statusCode} - ${e.reason}`);
    });
  }
};
github GoogleChrome / lighthouse / lighthouse-core / lib / sentry.js View on Github external
if (err.protocolMethod) {
        // @ts-ignore - properties added to protocol method LHErrors.
        opts.fingerprint = ['{{ default }}', err.protocolMethod, err.protocolError];
      }

      return new Promise(resolve => {
        Sentry.captureException(err, opts, () => resolve());
      });
    };

    const context = Object.assign({
      url: opts.url,
      emulatedFormFactor: opts.flags.emulatedFormFactor,
      throttlingMethod: opts.flags.throttlingMethod,
    }, opts.flags.throttling);
    Sentry.mergeContext({extra: Object.assign({}, opts.environmentData.extra, context)});
  } catch (e) {
    log.warn(
      'sentry',
      'Could not load raven library, errors will not be reported.'
    );
  }
}
github lifechurch / melos / feature-server.js View on Github external
}), nr.createTracer('loadDataFailed', (errorDetail) => {
				Raven.mergeContext({ extra: { errorDetail, params } })
				Raven.captureException(new Error(`LoadData Error - Could Not Render ${feature} view`))
				nr.endTransaction()
				res.status(404).send(errorDetail)
			}))
		} catch (ex) {
github lifechurch / melos / nodejs / feature-server.js View on Github external
}, (errorDetail) => {
				Raven.mergeContext({ extra: { errorDetail, params } })
				Raven.captureException(new Error(`LoadData Error - Could Not Render ${feature} view`))
				res.status(404).send(errorDetail)
			})
		} catch (ex) {
github bobvanderlinden / probot-auto-merge / src / pull-request-handler.ts View on Github external
}
      } else {
        return {
          code: 'merge',
          message: 'Will merge the pull request',
          actions: ['merge']
        }
      }
    case null:
      return {
        code: 'mergeable_not_supplied',
        message: 'GitHub did not provide merge state of PR',
        actions: ['reschedule']
      }
    default:
      Raven.mergeContext({
        extra: { pullRequestInfo }
      })
      throw new Error(`Merge state (${pullRequestInfo.mergeStateStatus}) was not recognized`)
  }
}
github bobvanderlinden / probot-auto-merge / src / pull-request-handler.ts View on Github external
Raven.mergeContext({
    extra: {
      pullRequestInfo
    }
  })

  const pullRequestStatus = getPullRequestStatus(
    context,
    conditions,
    pullRequestInfo
  )

  context.log.debug('pullRequestStatus:', pullRequestStatus)

  Raven.mergeContext({
    extra: {
      pullRequestStatus
    }
  })

  log(`result:\n${JSON.stringify(pullRequestStatus, null, 2)}`)
  await handlePullRequestStatus(
    context,
    pullRequestInfo,
    pullRequestStatus
  )
}
github argos-ci / argos / src / modules / crashReporter / server.js View on Github external
export const captureClientRelease = () => (req, res, next) => {
  if (req.headers['x-argos-release-version']) {
    raven.mergeContext({
      tags: { clientReleaseVersion: req.headers['x-argos-release-version'] },
    })
  } else if (req.headers['x-argos-cli-version']) {
    raven.mergeContext({
      tags: { clientCliVersion: req.headers['x-argos-cli-version'] },
    })
  }

  next()
}