Mariapacana has uploaded a new change for review.
https://gerrit.wikimedia.org/r/104125
Change subject: Creates errorLog function in mediawiki.Util.js.
......................................................................
Creates errorLog function in mediawiki.Util.js.
* errorLog prints out an error message and the context in which an
error occurred.
* uses errorLog on line 611 of dom.wrapTemplates.js, rather than
manually printing out an error's context.
Change-Id: I9265400f8e21952bda233eec86f0971cbd2f61a9
---
M lib/dom.wrapTemplates.js
M lib/mediawiki.Util.js
2 files changed, 30 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/25/104125/1
diff --git a/lib/dom.wrapTemplates.js b/lib/dom.wrapTemplates.js
index 1544ef8..ab6857c 100644
--- a/lib/dom.wrapTemplates.js
+++ b/lib/dom.wrapTemplates.js
@@ -605,17 +605,17 @@
range.start.setAttribute("data-mw",
JSON.stringify(datamw));
range.start.data.parsoid.pi = paramInfoArrays;
}
+
} else {
- var location = 'ERROR in ' + env.conf.wiki.iwp + ':' +
env.page.name;
- if ( env.page.revision && env.page.revision.revid ) {
- location += ' with oldid: ' +
env.page.revision.revid;
- }
- console.warn(location);
- console.warn("Do not have necessary info. to
encapsulate Tpl: " + i);
- console.warn("Start Elt : " + startElem.outerHTML);
- console.warn("End Elt : " + range.endElem.innerHTML);
- console.warn("Start DSR : " + JSON.stringify(dp1 ||
{}));
- console.warn("End DSR : " + JSON.stringify(dp2 ||
{}));
+
+ var err = [ "Do not have necessary info. to encapsulate
Tpl: " + i ];
+ err.push( "Start Elt : " + startElem.outerHTML );
+ err.push( "End Elt : " + range.endElem.innerHTML );
+ err.push( "Start DSR : " + JSON.stringify(dp1 || {}) );
+ err.push( "End DSR : " + JSON.stringify(dp2 || {}) );
+
+ Util.errorLog( env, err );
+
}
// Remove startElem (=range.startElem) if a meta. If a meta,
diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index aa0a625..e91c770 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -973,6 +973,26 @@
}
}
console.error(out.join(arguments[1]));
+ },
+
+ /**
+ * @method
+ *
+ * Prints out an error message and the context in which the error
occurred.
+ *
+ * @param {Object} env The wiki page's environment.
+ * @param {Object} err The error message.
+ *
+ * @returns {null}
+ */
+
+ errorLog: function( env, err ) {
+ var location = 'ERROR in ' + env.conf.wiki.iwp + ':' +
env.page.name;
+ if ( env.page.revision && env.page.revision.revid ) {
+ location += ' with oldid: ' + env.page.revision.revid;
+ }
+ console.warn( location );
+ console.warn( err.join("\n") );
}
};
--
To view, visit https://gerrit.wikimedia.org/r/104125
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9265400f8e21952bda233eec86f0971cbd2f61a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Mariapacana <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits