Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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(' '));
};
}
}
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))
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.
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.