* It turns out IE9 throws up on console.error.call
("TypeError: Object does not property method 'call'.")
Which is problematic since module handlers that catch exceptions
and try to log them, now still get a global uncaught exception.
Luckily it only affected users of IE9 that have DevTools installed
locally -and- were on a page with module that throws an exception.
* Follows-up
4c80300499d783333e24331f7c5a368ecf24c3bf
* Now just not logging the exception object if there is no
console.error. Pretty much every console has it, and when they
don't, then having the exception object is likely not going to
help either. Not to confuse with mw.log, which is elaborate
cross-browser fallbacks and always shows all information in the
browser somehow. This is for logging errors without debug mode.
Change-Id: I1bf6c6f963ca64182dd447bebc0e6751bce325ae
var console = window.console;
if ( console && console.log ) {
console.log( msg );
- // console.error triggers the proper handling of exception objects in
- // consoles that support it. Fallback to passing as plain object to log().
- if ( e ) {
- (console.error || console.log).call( console, e );
+ // If we have an exception object, log it through .error() to trigger
+ // proper stacktraces in browsers that support it. There are no (known)
+ // browsers that don't support .error(), that do support .log() and
+ // have useful exception handling through .log().
+ if ( e && console.error ) {
+ console.error( e );
}
}
}
} catch ( ex ) {
// A user-defined operation raised an exception. Swallow to protect
// our state machine!
- log( 'mw.loader::handlePending> Exception thrown by job.error()', ex );
+ log( 'Exception thrown by job.error()', ex );
}
}
}