jenkins-bot has submitted this change and it was merged.
Change subject: mw.loader: Always log exceptions caught from userland callbacks
......................................................................
mw.loader: Always log exceptions caught from userland callbacks
We usually don't catch these at all (not supposed to, as they're
foreign). But in case of handlePending() we catch them because
we need to ensure the state is kept track of properly (an error
is never final in javascript since execution always continues).
However we should at least log it in that case. We already did this
in case of the error() callback, it now does this for the ready()
callback as well.
Bug: 55989
Change-Id: I61f109178833fed60fbba7725fd47b4ff3d2edf4
(cherry picked from commit 8bee2b1fdfa85c4b26cb2d747a8d599b018a5d4d)
---
M resources/mediawiki/mediawiki.js
1 file changed, 6 insertions(+), 10 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js
index c470186..80223e5 100644
--- a/resources/mediawiki/mediawiki.js
+++ b/resources/mediawiki/mediawiki.js
@@ -831,22 +831,18 @@
j -= 1;
try {
if ( hasErrors ) {
- throw new
Error( 'Module ' + module + ' failed.');
+ if (
$.isFunction( job.error ) ) {
+
job.error( new Error( 'Module ' + module + ' has failed dependencies' ),
[module] );
+ }
} else {
if (
$.isFunction( job.ready ) ) {
job.ready();
}
}
} catch ( e ) {
- if ( $.isFunction(
job.error ) ) {
- try {
-
job.error( e, [module] );
- } catch ( ex ) {
- // A
user-defined operation raised an exception. Swallow to protect
- // our
state machine!
- log(
'Exception thrown by job.error', ex );
- }
- }
+ // A user-defined
callback raised an exception.
+ // Swallow it to
protect our state machine!
+ log( 'Exception thrown
by job.error', e );
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/91987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I61f109178833fed60fbba7725fd47b4ff3d2edf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_22
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits