Fix Tidy quietly breaking TOC disabling

The functionality was introduced in I2889bcb9
but doesn't work in presence if Tidy.

Change-Id: Ibf96cc3bc94fac75fd92ec5b9205011fcb68f0c2
(cherry picked from commit d6f673c1157b75b33f9eeb3169fc2be25fb99da0)
mediawiki.js: Handle error better in log() and move out of mw.loader

console.error (in Chrome dev tools) takes an Error object. It
renders the stack trace nicely (incl. dynamic references to files)
but doesn't stringify the exception itself. It renders it as an
object (eg. no "{}" instead of "TypeError: Foo bar").

Some of the callers were embedding e.message manually. That was
better though, that still omitted the class (eg. "TypeError").
Error#toString composes the full message incl. class name prefix.

Change-Id: Id5b9872e2050326ab83889e3a806d015ec2ff3eb
(cherry picked from commit 4f23099c223a7525774afd4d18b89cff22374581)
Merge "Fix Tidy quietly breaking TOC disabling" into REL1_22