mediawiki.loader: Fix logError() not to print exceptions twice
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 13 Dec 2017 22:45:45 +0000 (23:45 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 14 Dec 2017 19:56:34 +0000 (20:56 +0100)
Current behaviour results in:

Chrome 65 (initial)
> ▶ [WARN] Error: foo Error: foo
>  at bar
>  at main

Chrome 65 (expanded)
> ▼ [WARN] Error: foo Error: foo
>            at bar
>            at main
>  at logError
>  at main

Safari 11 (initial)
> ▶ [WARN] Error: foo, Error: foo

Safari 11 (expanded)
> ▼ [WARN] Error: foo is undefined
>     * Error: foo is undefined
>         at bar
>         at main

Firefox 57
> [WARN] Error: foo | Error: foo
>                   | Stacktrace:
>                   |   bar
>                   |   main

I don't recall why I did it this way, but it seems redundant.
This commit effectively removes the first "Error: foo"

Change-Id: Idc5dee34ce2b5068e3a2d8800e2b5f6b879525d1

resources/src/mediawiki/mediawiki.js

index 393ab4a..6a218e3 100644 (file)
                        // 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 );
+                               console.warn( e );
                        }
                }
                /* eslint-enable no-console */