resourceloader: Reduce severity for non-fatal JS errors to warn()
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 5 Sep 2017 15:29:34 +0000 (17:29 +0200)
committerKrinkle <krinklemail@gmail.com>
Tue, 5 Sep 2017 15:31:09 +0000 (15:31 +0000)
Follows-up 37df74151 and 12cca1c6, which made the internal exceptions
from sortDependencies() for unknown modules, or circular dependencies,
get logged to the console instead of silently caught.

There were logged using mw.track('resourceloader.exception') which
get logged to the console using console.error() by default.

Change this to using console.warn() instead.

Until 37df74151 and 12cca1c6, messages from `resourceloader.exception` where
quite rare. However both the rare cases, as well as the cases we added in
these commits, are non-fatal. Given various false reports in recent weeks
on Phabricator from users thinking they are witnessing fatal errors, let's
change the severity level of these in the browser console to "warn" instead
of "error", which makes them easier to distinguish from fatal errors.

Change-Id: I8d7aff6c72e74836c034b18a5ff58428d27628ff

resources/src/mediawiki/mediawiki.js

index c5989c0..fc930ca 100644 (file)
                        msg += ( e ? ':' : '.' );
                        console.log( msg );
 
-                       // If we have an exception object, log it to the error channel to trigger
-                       // proper stacktraces in browsers that support it. No fallback as we have
-                       // no browsers that don't support error(), but do support log().
-                       if ( e && console.error ) {
-                               console.error( String( e ), e );
+                       // If we have an exception object, log it to the warning channel to trigger
+                       // proper stacktraces in browsers that support it.
+                       if ( e && console.warn ) {
+                               console.warn( String( e ), e );
                        }
                }
                /* eslint-enable no-console */