Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200293

Change subject: [HOLD] Log error id to console
......................................................................

[HOLD] Log error id to console

Leaves a console message so that the user can refer to the log
entry when reporting the bug.
(Also add some private markers to the doc blocks.)

Per discussion with Ori, hold this until we see an actual need for
it to make sure we don't unnecessarily complicate the error
reporting process.

Bug: T89384
Change-Id: Ib531fcb01e2315c38934b783654a0a76ee383d0d
---
M resources/init.js
1 file changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Sentry 
refs/changes/93/200293/1

diff --git a/resources/init.js b/resources/init.js
index 6b8e22b..88bdc61 100644
--- a/resources/init.js
+++ b/resources/init.js
@@ -2,6 +2,21 @@
        var raven;
 
        /**
+        * Notifies the user about the error and what error id to use when 
reporting it.
+        * @private
+        * @param {string} id
+        */
+       function logId( id ) {
+               var log = window.console && ( console.warn || console.log );
+
+               if ( log && id ) {
+                       log.call( console, 'MediaWiki error logging: reported 
an error with id ' + id );
+                       log.call( console, 'Please refer to this error id when 
reporting an error.' );
+               }
+       }
+
+       /**
+        * @private
         * @return {jQuery.Deferred} a deferred with the Raven.js object
         */
        function initRaven() {
@@ -34,6 +49,10 @@
 
                                Raven.config( config.dsn, options ).install();
 
+                               $( document ).on( 'ravenSuccess', function ( e 
) {
+                                       logId( e.originalEvent.data.event_id );
+                               } );
+
                                raven = Raven;
                        }
                        return raven;
@@ -41,6 +60,7 @@
        }
 
        /**
+        * @private
         * @param {string} topic mw.track() queue name
         * @param {Object} data
         * @param {Mixed} data.exception The exception which has been caught

-- 
To view, visit https://gerrit.wikimedia.org/r/200293
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib531fcb01e2315c38934b783654a0a76ee383d0d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Sentry
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to