diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts b/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts index c36861e8c4..f27dea2445 100644 --- a/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts +++ b/services/web/frontend/js/features/source-editor/extensions/spelling/spellchecker.ts @@ -127,7 +127,7 @@ export class SpellChecker { debugConsole.error(result.error) captureException( new Error('Error running spellcheck for word'), - { language: this.language } + { tags: { ol_spell_check_language: this.language } } ) } else { processResult(result.misspellings) diff --git a/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx index fc2a0cd2da..d4beaa2ab7 100644 --- a/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx +++ b/services/web/frontend/js/features/source-editor/extensions/spelling/spelling-suggestions.tsx @@ -66,7 +66,7 @@ export const SpellingSuggestions: FC<{ }) .catch(error => { captureException(error, { - language: spellCheckLanguage, + tags: { ol_spell_check_language: spellCheckLanguage }, }) debugConsole.error(error) }) diff --git a/services/web/frontend/js/features/source-editor/hunspell/HunspellManager.ts b/services/web/frontend/js/features/source-editor/hunspell/HunspellManager.ts index f0b67e89f3..690cee45b5 100644 --- a/services/web/frontend/js/features/source-editor/hunspell/HunspellManager.ts +++ b/services/web/frontend/js/features/source-editor/hunspell/HunspellManager.ts @@ -161,7 +161,7 @@ export class HunspellManager { this.loaded = true } else if (rest.loadingFailed) { captureException(new Error('Spell check loading failed'), { - language: this.language, + tags: { ol_spell_check_language: this.language }, }) this.loadingFailed = true this.pendingMessages.length = 0 diff --git a/services/web/frontend/js/infrastructure/error-reporter.ts b/services/web/frontend/js/infrastructure/error-reporter.ts index 14de720a1f..6c9eb40ecb 100644 --- a/services/web/frontend/js/infrastructure/error-reporter.ts +++ b/services/web/frontend/js/infrastructure/error-reporter.ts @@ -101,7 +101,14 @@ function nullReporter() { }) } -export function captureException(err: Error, options?: Record) { +// https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/ +// https://docs.sentry.io/platforms/javascript/enriching-events/context/#passing-context-directly +type Options = { + tags?: Record + extra?: Record +} + +export function captureException(err: Error, options?: Options) { options = options || {} const extra = Object.assign(OError.getFullInfo(err), options.extra || {}) const fullStack = OError.getFullStack(err)