Remove error message from event_label.

The event_label is meant for rough classification, it should also not
contain any potentially sensitive information. Error message on the
other hand is freeform and can often contain user input.

Google-Bug-Id: b/250822247
Release-Notes: skip
Change-Id: Idc0e3ae77b0cd5bc5d5d3c98156979e2159ddb7a
diff --git a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
index 33b9176..dadf9e4 100644
--- a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
+++ b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
@@ -120,7 +120,7 @@
       line = line ?? error.lineNumber;
       column = column ?? error.columnNumber;
     }
-    reportingService.error(normalizeError(error), 'onError', {
+    reportingService.error('onError', normalizeError(error), {
       line,
       column,
       url,
@@ -143,7 +143,7 @@
     context.addEventListener(
       'unhandledrejection',
       (e: PromiseRejectionEvent) => {
-        reportingService.error(normalizeError(e.reason), 'unhandledrejection');
+        reportingService.error('unhandledrejection', normalizeError(e.reason));
       }
     );
   };
@@ -862,16 +862,20 @@
     this.reportExecution(Execution.PLUGIN_API, {plugin, object, method});
   }
 
-  error(error: Error, errorSource?: string, details?: EventDetails) {
-    const eventDetails = details ?? {};
-    const message = `${errorSource ? errorSource + ': ' : ''}${error.message}`;
+  error(errorSource: string, error: Error, details?: EventDetails) {
+    const message = `${errorSource}: ${error.message}`;
+    const eventDetails = {
+      errorMessage: message,
+      ...details,
+      stack: error.stack,
+    };
 
     this.reporter(
       ERROR.TYPE,
       ERROR.CATEGORY.EXCEPTION,
-      message,
+      errorSource,
       {error},
-      {...eventDetails, stack: error.stack}
+      eventDetails
     );
   }
 
@@ -879,8 +883,9 @@
     this.reporter(
       ERROR.TYPE,
       ERROR.CATEGORY.ERROR_DIALOG,
-      'ErrorDialog: ' + message,
-      {error: new Error(message)}
+      'ErrorDialog',
+      {error: new Error(message)},
+      {errorMessage: message}
     );
   }