How to use the raven-js.setUserContext function in raven-js

To help you get started, we’ve selected a few raven-js 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 simon-weber / Autoplaylists-for-Google-Music / src / js / reporting.js View on Github external
function setContext(isBackground, context) {
  console.log('setting context:', isBackground, context);

  cachedContext = context;

  GATracker.set('userId', context.reportingUUID);
  GATracker.set('dimension1', context.tags.hasFullVersion ? 'full' : 'free');
  GATracker.set('dimension2', context.tags.isDeveloper ? 'yes' : 'no');
  GATracker.set('dimension5', context.tags.licenseState);

  Raven.setUserContext(context.user);
  context.tags.isBackground = isBackground; // eslint-disable-line no-param-reassign
  Raven.setTagsContext(context.tags);
}
github simon-weber / Autoplaylists-for-Google-Music / src / js / reporting.js View on Github external
function setContext(isBackground, context) {
  console.log('setting context:', isBackground, context);

  cachedContext = context;

  GATracker.set('userId', context.reportingUUID);
  GATracker.set('dimension1', context.tags.hasFullVersion ? 'full' : 'free');
  GATracker.set('dimension2', context.tags.isDeveloper ? 'yes' : 'no');

  Raven.setUserContext(context.user);
  context.tags.isBackground = isBackground; // eslint-disable-line no-param-reassign
  Raven.setTagsContext(context.tags);
}
github csegames / Camelot-Unchained / game / hud / src / sentry.tsx View on Github external
import Raven from 'raven-js';

if (process.env.ENABLE_SENTRY) {
  Raven.config('https://f7710348f19c4a0f8f8cd83ea0aa343f@sentry.io/1259561', {
    release: process.env.GIT_REVISION, // use git revision as release? {{process.env.GIT_REVISION}}
    environment: 'development-test',
    tags: {
      module: process.env.NAME,
    },
  }).install();

  if (game) {
    Raven.setTagsContext({
      shard: game.shardID,
    });
    Raven.setUserContext({
      id: game.selfPlayerState.characterID,
    });
  }
  setTimeout(() => {
    Raven.setTagsContext({
      shard: game.shardID,
    });
    Raven.setUserContext({
      id: game.selfPlayerState.characterID,
    });
  }, 1000);
}
github DefinitelyTyped / DefinitelyTyped / raven-js / raven-js-tests.ts View on Github external
try {
    throwsError();
} catch(e) {
    RavenJS.captureException(e);
    RavenJS.captureException(e, {tags: { key: "value" }});
}

RavenJS.context(throwsError);
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);

setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();

RavenJS.setUserContext({
    email: 'matt@example.com',
    id: '123'
});

RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});

RavenJS.showReportDialog({
    eventId: 0815,
    dsn:'1337asdf',
    user: {
        name: 'DefenitelyTyped',
        email: 'df@ts.ms'
    }
});
github hypothesis / client / src / sidebar / raven.js View on Github external
function setUserInfo(info) {
  if (info) {
    Raven.setUserContext(info);
  } else {
    Raven.setUserContext();
  }
}
github cyverse / troposphere / troposphere / static / js / components / Master.jsx View on Github external
loadRavenData: function() {
        let profile = context.profile;
        let userContext = {
            id: profile.get("user"),
            email: profile.get("email"),
            username: profile.get("username")
        };

        if (context.hasEmulatedSession()) {
            userContext.emulated = true;
            userContext.emulator = context.getEmulator();
        }

        Raven.setUserContext(userContext);
        Raven.setTagsContext(window.SENTRY_TAGS);
    },
github OpenNeuroOrg / openneuro / app / src / scripts / user / user.store.js View on Github external
.then(res => {
            this.update({ scitran: res.body }, { persist: true })
            Raven.setUserContext({
              email: user.profile.email,
              id: user.profile._id,
            })
          })
          .catch(err => {
github commercetools / merchant-center-application-kit / src / utils / sentry.js View on Github external
export const stopTrackingUser = () => {
  if (window.app.env === 'production') Raven.setUserContext();
};
github OpenNeuroOrg / openneuro / packages / openneuro-app / src / scripts / user / user.store.js View on Github external
signinError: message,
          })
        }
        return
      }

      this.update(
        {
          token: user.token,
          profile: user.profile,
          provider: options.provider,
        },
        { persist: true },
      )

      Raven.setUserContext({
        email: user.profile.email,
        id: user.profile._id,
      })

      crn
        .verifyUser()
        .then(res => {
          if (!res.body._id) {
            this.clearAuth()
            let message =
              'We are currently experiencing issues. Please try again later.'
            if (!transition) {
              notifications.createAlert({ type: 'Error', message: message })
            } else {
              this.update({
                loading: false,
github arjun27 / rubberduck / src / content_script / utils / crashes.js View on Github external
export const setupUser = userInfo => {
  Raven.setUserContext(userInfo);
};