From: Timo Tijhof Date: Tue, 5 Sep 2017 15:29:34 +0000 (+0200) Subject: resourceloader: Reduce severity for non-fatal JS errors to warn() X-Git-Tag: 1.31.0-rc.0~2216 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=4f003bdd6092c4d21fa38c7a3bef11322f371fa1;p=lhc%2Fweb%2Fwiklou.git resourceloader: Reduce severity for non-fatal JS errors to warn() 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 --- diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index c5989c0eb1..fc930ca088 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -2761,11 +2761,10 @@ 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 */