Эх сурвалжийг харах

Use `ol_spell_check_language` tag for error reporting (#21126)

GitOrigin-RevId: 11580f8dca22b0d4858dc5db36827b69a3637371
Alf Eaton 1 жил өмнө
parent
commit
a238b8eee4

+ 1 - 1
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)

+ 1 - 1
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)
         })

+ 1 - 1
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

+ 8 - 1
services/web/frontend/js/infrastructure/error-reporter.ts

@@ -101,7 +101,14 @@ function nullReporter() {
   })
 }
 
-export function captureException(err: Error, options?: Record<string, any>) {
+// 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<string, any>
+  extra?: Record<string, any>
+}
+
+export function captureException(err: Error, options?: Options) {
   options = options || {}
   const extra = Object.assign(OError.getFullInfo(err), options.extra || {})
   const fullStack = OError.getFullStack(err)