From 123e2a4d13aa6db04a0f5a2a3f145e4bbc74c712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 2 Dec 2015 14:31:42 +0100 Subject: [PATCH] Add functionality to avoid sending error messages to sentry --- js/constants/application_constants.js | 7 ++++++- js/utils/error_utils.js | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/constants/application_constants.js b/js/constants/application_constants.js index a58a8cc6..67b8614d 100644 --- a/js/constants/application_constants.js +++ b/js/constants/application_constants.js @@ -114,7 +114,12 @@ const constants = { }, 'twitter': { 'sdkUrl': 'https://platform.twitter.com/widgets.js' - } + }, + + 'errorMessagesToIgnore': [ + 'Authentication credentials were not provided.', + 'Informations d\'authentification non fournies.' + ] }; export default constants; diff --git a/js/utils/error_utils.js b/js/utils/error_utils.js index 4e9de6e2..6306ece4 100644 --- a/js/utils/error_utils.js +++ b/js/utils/error_utils.js @@ -13,8 +13,7 @@ import AppConstants from '../constants/application_constants'; * @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 */ -function logGlobal(error, ignoreSentry, comment) { - +function logGlobal(error, ignoreSentry = AppConstants.errorMessagesToIgnore.indexOf(error.message) > -1, comment) { console.error(error); if(!ignoreSentry) {