diff --git a/packages/common/errorreport.js b/packages/common/errorreport.js deleted file mode 100644 index 4f17f456ac068d921d43bf6870f064d89d7fe63b..0000000000000000000000000000000000000000 --- a/packages/common/errorreport.js +++ /dev/null @@ -1,96 +0,0 @@ -import * as Sentry from '@sentry/browser'; - -let _isInitialized = false; -let _canReportEvent = false; - -let sentryDSN = ''; - -/** - * Initializes error reporting. - * - * If a sentry DSN is set we will use sentry, if not we will log to the console. - * - * @param {object} [options] - * @param {boolean} [options.debug=false] Enable debug output - * @param {string} [options.release] The project release - */ -export function init(options) { - let defaults = { - debug: false, - }; - let actual = Object.assign({}, defaults, options); - - if (_isInitialized) throw new Error('Already initialized'); - - let sentryOptions = {debug: actual.debug}; - - if (actual.release) { - sentryOptions['release'] = actual.release; - } - - if (actual.environment) { - sentryOptions['environment'] = actual.environment; - } - - if (!sentryDSN) { - if (options.debug) console.log('No sentry DSN set, sentry disabled'); - - // In case we don't have a sentry config, we still use sentry, but print - // all events into the console don't send them to the server. - // XXX: Dummy DSN needed to make init() work. - sentryOptions['dsn'] = 'http://12345@dummy.dummy/42'; - sentryOptions['beforeSend'] = (event, hint) => { - console.error('ERR-REPORT:', hint.originalException || hint.syntheticException); - return null; - }; - } else { - sentryOptions['dsn'] = sentryDSN; - _canReportEvent = true; - } - - Sentry.init(sentryOptions); - - _isInitialized = true; -} - -/** - * Whether showReportDialog() will work. - */ -export function canReportEvent() { - if (!_isInitialized) throw new Error('Not initialized'); - return _canReportEvent; -} - -/** - * Show a report dialog for user error feedback. - * - * Call canReportEvent() first to see if this will do anything. - */ -export function showReportDialog() { - if (!canReportEvent()) return; - Sentry.showReportDialog(); -} - -/** - * Log an exception - * - * @param {*} exception - */ -export function captureException(exception) { - if (!_isInitialized) throw new Error('Not initialized'); - Sentry.captureException(exception); -} - -/** - * Log a message, returns an internal ID - * - * @param {string} message The message to log - * @param {string} [level=error] The loglevel (error, warning, info, debug) - */ -export function captureMessage(message, level) { - if (!_isInitialized) throw new Error('Not initialized'); - if (!level) level = 'error'; - if (!['error', 'warning', 'info', 'debug'].includes(level)) - throw new Error('Invalid log level'); - Sentry.captureMessage(message, level); -} diff --git a/packages/common/package.json b/packages/common/package.json index 9a9076b469eccf48209f65587754e554562c632c..99edc2eb1dac1853b12dbf7f982db6659f304574 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -42,7 +42,6 @@ }, "dependencies": { "@open-wc/scoped-elements": "^2.0.0", - "@sentry/browser": "^6.0.0", "i18next": "^21.4.2", "lit": "^2.0.0" } diff --git a/yarn.lock b/yarn.lock index aa7e3961dbcd749a312cff6371fd5794d129b266..7826a49fbef77a46fe0dd7d6e756fc0097589813 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1974,58 +1974,6 @@ estree-walker "^2.0.1" picomatch "^2.2.2" -"@sentry/browser@^6.0.0": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.19.3.tgz#b4cfc6eba48d10a5fdf096c05ca11303354edb8b" - integrity sha512-E8UA6IN8z9hL6aGzOHUzqgNZiBwARkA89i8ncKB9QU1/+jl7598ZLziN4+uyPeZiRquEz8Ub7Ve1eacs1u+fbw== - dependencies: - "@sentry/core" "6.19.3" - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" - tslib "^1.9.3" - -"@sentry/core@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.3.tgz#88268afc8c42716c455ad77bb4bed2bbf96abd83" - integrity sha512-RcGmYdkrE3VYBMl9Hgv4GKsC8FEVUdWYsfGIcT/btwP2YpBeUaTZl+1vV9r3Ncdl125LqzP5CKSj5otVxiEg6g== - dependencies: - "@sentry/hub" "6.19.3" - "@sentry/minimal" "6.19.3" - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" - tslib "^1.9.3" - -"@sentry/hub@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.3.tgz#d555c83404f19ac9b68f336b051b8e7a9d75feb0" - integrity sha512-iYbkrxEZt6CrHP3U3r54MARVZSs3YHjAMUMOTlC16s/Amz1McwV95XtI3NJaqMhwzl7R5vbGrs3xOtLg1V1Uyw== - dependencies: - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" - tslib "^1.9.3" - -"@sentry/minimal@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.3.tgz#b9b7f0d7f0cd2341b243318668ac01458f9d7889" - integrity sha512-xy/6ThHK8B2NJT98nWrx6V9eVgUbzq2N/8lv5/QqrKsICjxx22TRC8Q6zPg/o7BYcrY5vpugSEbIeErTnyxHDA== - dependencies: - "@sentry/hub" "6.19.3" - "@sentry/types" "6.19.3" - tslib "^1.9.3" - -"@sentry/types@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.3.tgz#94b19da68d4d23561efb1014f72968bcea85cd0c" - integrity sha512-jHhqxp8MIWSfOc3krorirTGKTEaSFO6XrAvi+2AZhr6gvOChwOgzgrN2ZqesJcZmgCsqWV21u3usSwYeRrjOJA== - -"@sentry/utils@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.3.tgz#0c3a3f0b86c12e3b079e56e37a44e62a1226043d" - integrity sha512-GdC9B/FK7qd0zItY43135bYbhuVSawE18bIrQDNuno8gTpDJ5OgShpTN9zR53AmMh16/lwKNnV3ZZjlpKcxuNw== - dependencies: - "@sentry/types" "6.19.3" - tslib "^1.9.3" - "@socket.io/base64-arraybuffer@~1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#568d9beae00b0d835f4f8c53fd55714986492e61" @@ -8190,7 +8138,7 @@ ts-simple-type@~1.0.5: resolved "https://registry.yarnpkg.com/ts-simple-type/-/ts-simple-type-1.0.7.tgz#03930af557528dd40eaa121913c7035a0baaacf8" integrity sha512-zKmsCQs4dZaeSKjEA7pLFDv7FHHqAFLPd0Mr//OIJvu8M+4p4bgSFJwZSEBEg3ec9W7RzRz1vi8giiX0+mheBQ== -tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==