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/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts index 0a90775..d178880 100644 --- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts +++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts
@@ -399,7 +399,7 @@ }) .catch(err => { fireTitleChange(this, title || this.computeTitle(user)); - this.reporting.error(err); + this.reporting.error('Dashboard reload', err); }) .finally(() => { this.loading = false;
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts index 77a0eb2..88bf45e 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
@@ -1362,7 +1362,10 @@ revert dialog after revert button is pressed. */ this.restApiService.getChanges(0, query).then(changes => { if (!changes) { - this.reporting.error(new Error('changes is undefined')); + this.reporting.error( + 'Change Actions', + new Error('getChanges returns undefined') + ); return; } assertIsDefined(this.confirmRevertDialog, 'confirmRevertDialog'); @@ -1669,7 +1672,10 @@ ); break; default: - this.reporting.error(new Error('invalid revert type')); + this.reporting.error( + 'Change Actions', + new Error('invalid revert type') + ); } } @@ -2014,7 +2020,10 @@ .getChanges(0, query, undefined, options) .then(changes => { if (!changes) { - this.reporting.error(new Error('getChanges returns undefined')); + this.reporting.error( + 'Change Actions', + new Error('getChanges returns undefined') + ); return; } this.confirmCherrypick!.updateChanges(changes);
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts index 8293daa..e0fcd88 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -826,7 +826,10 @@ this.pluginTabsContentEndpoints.length !== this.pluginTabsHeaderEndpoints.length ) { - this.reporting.error(new Error('Mismatch of headers and content.')); + this.reporting.error( + 'Plugin change-view-tab', + new Error('Mismatch of headers and content.') + ); } }) .then(() => this.initActiveTab());
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts index 731f227..3e8530c 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
@@ -847,19 +847,28 @@ this.dynamicHeaderEndpoints.length !== this.dynamicContentEndpoints.length ) { - this.reporting.error(new Error('dynamic header/content mismatch')); + this.reporting.error( + 'Plugin change-view-file-list', + new Error('dynamic header/content mismatch') + ); } if ( this.dynamicPrependedHeaderEndpoints.length !== this.dynamicPrependedContentEndpoints.length ) { - this.reporting.error(new Error('dynamic header/content mismatch')); + this.reporting.error( + 'Plugin change-view-file-list', + new Error('dynamic prepend header/content mismatch') + ); } if ( this.dynamicHeaderEndpoints.length !== this.dynamicSummaryEndpoints.length ) { - this.reporting.error(new Error('dynamic header/content mismatch')); + this.reporting.error( + 'Plugin change-view-file-list', + new Error('dynamic header/summary mismatch') + ); } }); this.diffCursor = new GrDiffCursor(); @@ -2350,6 +2359,7 @@ const diffElem = this.findDiffByPath(path, diffElements); if (!diffElem) { this.reporting.error( + 'GrFileList', new Error(`Did not find <gr-diff-host> element for ${path}`) ); return; @@ -2364,6 +2374,7 @@ const diffElem = this.findDiffByPath(path, diffElements); if (!diffElem) { this.reporting.error( + 'GrFileList', new Error(`Did not find <gr-diff-host> element for ${path}`) ); return;
diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts index 97b20dc..5417127 100644 --- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts +++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts
@@ -448,6 +448,7 @@ if (!el && this.showAllActivity) { this.reporting.error( + 'GrMessagesList scroll', new Error(`Failed to scroll to message: ${messageID}`) ); return;
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts index 96a2aba..cd42a9f 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -1756,6 +1756,7 @@ return 'No additions to the attention set.'; } this.reporting.error( + 'computeDoNotUpdateMessage', new Error( 'computeDoNotUpdateMessage()' + 'should not be called when users were added to the attention set.' @@ -1829,6 +1830,7 @@ entry = suggestion.group; } else { this.reporting.error( + 'Reviewer Suggestion', new Error(`Suggestion is neither account nor group: ${suggestion}`) ); return false; @@ -1935,6 +1937,7 @@ return; } this.reporting.error( + 'confirmPendingReviewer', new Error('confirmPendingReviewer called without pending confirm') ); }
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts index 8d9f223..e663ae1 100644 --- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts +++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
@@ -259,7 +259,7 @@ ); } } - this.reporting.error(new Error(`Server error: ${errorText}`)); + this.reporting.error('Server error', new Error(errorText)); }); }; @@ -316,7 +316,7 @@ private readonly handleNetworkError = (e: NetworkErrorEvent) => { this._showAlert('Server unavailable'); - this.reporting.error(new Error(`network error: ${e.detail.error.message}`)); + this.reporting.error('Network error', new Error(e.detail.error.message)); }; // TODO(dhruvsri): allow less priority alerts to override high priority alerts
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts index 91c9dbcb..baf89c0 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts +++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts
@@ -497,9 +497,13 @@ if (e === DELAYED_CANCELLATION) { // Do nothing. } else if (e instanceof Error) { - this.reporting.error(e); + this.reporting.error('GrDiffHost Reload:', e); } else { - this.reporting.error(new Error('reloadPromise error'), undefined, e); + this.reporting.error( + 'GrDiffHost Reload:', + new Error('reloadPromise error'), + e + ); } } await this.updateComplete; @@ -570,11 +574,11 @@ return; } catch (e: unknown) { if (e instanceof Error) { - this.reporting.error(e); + this.reporting.error('GrDiffHost Reload:', e); } else { this.reporting.error( + 'GrDiffHost Reload:', new Error('reloadInternal error'), - undefined, e ); } @@ -657,9 +661,13 @@ if (e instanceof Response) { this.handleGetDiffError(e); } else if (e instanceof Error) { - this.reporting.error(e); + this.reporting.error('GrDiffHost Reload:', e); } else { - this.reporting.error(new Error('reload error'), undefined, e); + this.reporting.error( + 'GrDiffHost Reload:', + new Error('reload error'), + e + ); } } finally { this.reporting.timeEnd(Timing.DIFF_TOTAL, this.timingDetails()); @@ -884,12 +892,12 @@ }); }) .catch(err => { - this.reporting.error(err); + this.reporting.error('GrDiffHost Coverage', err); }); }); }) .catch(err => { - this.reporting.error(err); + this.reporting.error('GrDiffHost Coverage', err); }); }
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts index 18322fe..6ad8e2f 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts +++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
@@ -1669,6 +1669,7 @@ // If route is of type /comment/<commentId>/ then no patchNum is present if (!viewState.patchNum && !viewState.commentLink) { this.reporting.error( + 'GrDiffView', new Error(`Invalid diff view URL, no patchNum found: ${this.viewState}`) ); return;
diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts index 0b1a2de..a15a575 100644 --- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts +++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts
@@ -469,7 +469,7 @@ this.saveEdit().then(() => { const handleError: ErrorCallback = response => { this.showAlert(PUBLISH_FAILED_MSG); - this.reporting.error(new Error(response?.statusText)); + this.reporting.error('/edit:publish', new Error(response?.statusText)); }; this.showAlert(PUBLISHING_EDIT_MSG);
diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.ts b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.ts index d6d3775..61279cf 100644 --- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.ts +++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.ts
@@ -133,8 +133,9 @@ const paramName = paramEl.name; if (!paramName) { this.reporting.error( + `Plugin '${pluginName}', endpoint '${this.name}'`, new Error( - `plugin '${pluginName}' endpoint '${this.name}': param is missing a name.` + `Plugin '${pluginName}', endpoint '${this.name}': param is missing a name.` ) ); return; @@ -155,9 +156,10 @@ // and the return type is NodeJS.Timeout object (timeoutId = window.setTimeout(() => { this.reporting.error( + `Plugin '${pluginName}', endpoint '${this.name}'`, new Error( - 'Timeout waiting for endpoint properties initialization: ' + - `plugin ${pluginName}, endpoint ${this.name}` + `Plugin ${pluginName}, endpoint ${this.name}: ` + + 'Timeout waiting for endpoint properties initialization' ) ); }, INIT_PROPERTIES_TIMEOUT_MS))
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts index ecac9bc..9915d4c 100644 --- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts +++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
@@ -47,8 +47,8 @@ mayContinue = callback(e); } catch (exception: unknown) { this.reporting.error( + 'GrEventHelper', new Error('event listener callback error'), - undefined, exception ); }
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts index 157373e..7ab4689 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts
@@ -32,7 +32,10 @@ this.reporting.trackApi(this.plugin, 'annotation', 'setCoverageProvider'); if (this.coverageProvider) { this.reporting.error( - new Error(`Overwriting cov provider: ${this.plugin.getPluginName()}`) + 'Annotation Plugin', + new Error( + `Overwriting coverage provider: ${this.plugin.getPluginName()}` + ) ); } this.coverageProvider = coverageProvider;
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts index f77287b..b8bfd21 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
@@ -77,7 +77,10 @@ */ private setEl(el?: GrChangeActionsElement) { if (!el) { - this.reporting.error(new Error('changeActions() API is not ready')); + this.reporting.error( + 'GrChangeActionsInterface', + new Error('changeActions() API is not ready') + ); return; } this.el = el;
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts index e764fd6..353fc2a 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts
@@ -89,8 +89,8 @@ return callback(change, revision) === false; } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('canSubmitChange callback error'), - undefined, err ); } @@ -114,8 +114,8 @@ cb(detail.path); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('handleHistory callback error'), - undefined, err ); } @@ -159,8 +159,8 @@ cb(change, revision, info); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('showChange callback error'), - undefined, err ); } @@ -176,8 +176,8 @@ cb(detail.revisionActions, detail.change); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('showRevisionActions callback error'), - undefined, err ); } @@ -190,8 +190,8 @@ cb(change, msg); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('commitMessage callback error'), - undefined, err ); } @@ -205,8 +205,8 @@ cb(detail.node); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('comment callback error'), - undefined, err ); } @@ -219,8 +219,8 @@ cb(detail.change); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('labelChange callback error'), - undefined, err ); } @@ -233,8 +233,8 @@ cb(detail.hljs); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('HighlightjsLoaded callback error'), - undefined, err ); } @@ -247,8 +247,8 @@ revertMsg = cb(change, revertMsg, origMsg) as string; } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('modifyRevertMsg callback error'), - undefined, err ); } @@ -270,8 +270,8 @@ ) as string; } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('modifyRevertSubmissionMsg callback error'), - undefined, err ); } @@ -288,8 +288,8 @@ if (layer) layers.push(layer); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('getDiffLayers callback error'), - undefined, err ); } @@ -304,8 +304,8 @@ annotationApi.disposeLayer(path); } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('disposeDiffLayers callback error'), - undefined, err ); } @@ -354,8 +354,8 @@ } } catch (err: unknown) { this.reporting.error( + 'GrJsApiInterface', new Error('getReviewPostRevert callback error'), - undefined, err ); }
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts index 4715796..0628d2f 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts
@@ -100,6 +100,7 @@ if (!this.action.method) return; if (!this.action.__url) { this.reporting.error( + 'GrPluginActionContext', new Error(`Unable to ${this.action.method} to ${this.action.__key}!`) ); return;
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts index 33b6a4d..4a90314 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts
@@ -132,7 +132,11 @@ try { url = new URL(url); } catch (e: unknown) { - this._getReporting().error(new Error('url parse error'), undefined, e); + this._getReporting().error( + 'GrPluginLoader', + new Error('url parse error'), + e + ); return false; } } @@ -184,8 +188,8 @@ this._failToLoad(`${e.name}: ${e.message}`, src); } else { this._getReporting().error( + 'GrPluginLoader', new Error('plugin callback error'), - undefined, e ); }
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts index a4780eb2..21ab10a 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
@@ -71,6 +71,7 @@ if (!url) { this.report.error( + 'Plugin constructor', new Error( 'Plugin not being loaded from /plugins base path. Unable to determine name.' )
diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts index aae62aa..47d722d 100644 --- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts +++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts
@@ -275,7 +275,7 @@ } }) .catch(err => { - this.reporting.error(err); + this.reporting.error('Delete vote', err); target.disabled = false; return; });