1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

Merge pull request #100 from ascribe/AD-1453-add-functionality-to-avoid-sending-error-messages-to-sentry

Use Raven's `ignoreErrors` configuration option to ignore certain errors
This commit is contained in:
Brett Sun 2016-01-18 18:30:38 +01:00
commit 0382704098

View File

@ -13,22 +13,19 @@ import AppConstants from '../constants/application_constants';
* @param {boolean} ignoreSentry Defines whether or not the error should be submitted to Sentry * @param {boolean} ignoreSentry Defines whether or not the error should be submitted to Sentry
* @param {string} comment Will also be submitted to Sentry, but will not be logged * @param {string} comment Will also be submitted to Sentry, but will not be logged
*/ */
function logGlobal(error, comment, ignoreSentry = AppConstants.errorMessagesToIgnore.indexOf(error.message) > -1) { function logGlobal(error, comment, ignoreSentry) {
console.error(error); console.error(error);
if (!ignoreSentry) { if (!ignoreSentry) {
if(comment) { Raven.captureException(error, comment ? { extra: { comment } } : undefined);
Raven.captureException(error, {extra: { comment }});
} else {
Raven.captureException(error);
}
} }
} }
export function initLogging() { export function initLogging() {
// Initialize Raven for logging on Sentry // Initialize Raven for logging on Sentry
Raven.config(AppConstants.raven.url, { Raven.config(AppConstants.raven.url, {
release: AppConstants.version release: AppConstants.version,
ignoreErrors: AppConstants.errorMessagesToIgnore
}).install(); }).install();
window.onerror = Raven.process; window.onerror = Raven.process;