How to use the raven-js.setUser 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 guardian / facia-tool / public / src / js / main.js View on Github external
function registerRaven (res) {
    if (res.defaults.env.toUpperCase() !== 'DEV' && res.defaults.sentryPublicDSN) {
        const sentryOptions = {
            tags: {
                stack: 'cms-fronts',
                stage: res.defaults.env.toUpperCase(),
                app: 'facia-tool'
            }
        };

        Raven.config(res.defaults.sentryPublicDSN, sentryOptions).install();
        Raven.setUser({
            email: res.defaults.email || 'anonymous'
        });
        // ES6 loader uses console.error to log un-handled rejected promises
        var originalConsole = window.console.error;
        window.console.error = function () {
            originalConsole.apply(window.console, arguments);
            Raven.captureMessage([].slice.apply(arguments).join(' '));
        };
    }
}
github kof / kiipost / app / components / log / index.js View on Github external
console.log(obj, options)
        return setTimeout(callback, 500)
    }

    if (options.sentryDsn) {
        raven.captureException(obj, options)
    } else {
        console.log(obj)
    }

    // Let raven send the error before executing callback, because
    // callback can reload the page.
    setTimeout(callback, 500)
}

exports.setUser = raven.setUser

exports.setup = function(_options) {
    if (!_options.sentryDsn) throw new Error('Sentry dsn required')
    options = _options
    raven.config(options.sentryDsn, {
        logger: 'web',
        ignoreErrors: [
            'Script error.'
        ]
    }).install()

    if (options.reload) {
        document.addEventListener('ravenHandle', _.debounce(function() {
            alert('Ups, an error is happened. Our developers are notified.')
            location.reload()
        }, 300))
github quay / quay / static / js / services / user-service.js View on Github external
mixpanel.people.set({
              '$email': userResponse.email,
              '$username': userResponse.username,
              'verified': userResponse.verified
            });
            mixpanel.people.set_once({
              '$created': new Date()
            })
          } catch (e) {
            window.console.log(e);
          }
        }

        if (window.Raven !== undefined) {
          try {
            Raven.setUser({
              email: userResponse.email,
              id: userResponse.username
            });
          } catch (e) {
            window.console.log(e);
          }
        }

        CookieService.putPermanent('quay.loggedin', 'true');
      } else {
        if (window.Raven !== undefined) {
          Raven.setUser();
        }
      }

      // If the loaded user has a prompt, redirect them to the update page.
github quay / quay / config_app / js / services / user-service.js View on Github external
mixpanel.people.set({
              '$email': userResponse.email,
              '$username': userResponse.username,
              'verified': userResponse.verified
            });
            mixpanel.people.set_once({
              '$created': new Date()
            })
          } catch (e) {
            window.console.log(e);
          }
        }

        if (window.Raven !== undefined) {
          try {
            Raven.setUser({
              email: userResponse.email,
              id: userResponse.username
            });
          } catch (e) {
            window.console.log(e);
          }
        }

        CookieService.putPermanent('quay.loggedin', 'true');
      } else {
        if (window.Raven !== undefined) {
          Raven.setUser();
        }
      }

      // If the loaded user has a prompt, redirect them to the update page.