Mobrovac has submitted this change and it was merged.
Change subject: Fix problem with error reporting
......................................................................
Fix problem with error reporting
* Improve the error handling for chemistry commands,
outside the chemistry environment.
* Return an error message that is formatted in the same
way as other error messages are formatted.
Bug: T126057
Change-Id: I73802b2be2d10e8395c1751eb31930d634be00fa
---
M package.json
M test/features/math/simple.js
2 files changed, 15 insertions(+), 1 deletion(-)
Approvals:
Mobrovac: Verified; Looks good to me, approved
diff --git a/package.json b/package.json
index 5a37b2c..982bdce 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"preq": "^0.4.8",
"service-runner": "^1.1.3",
"mathoid-mathjax-node": "^0.5.0",
- "texvcinfo": "^0.4.1"
+ "texvcinfo": "^0.4.2"
},
"devDependencies": {
"extend": "^3.0.0",
diff --git a/test/features/math/simple.js b/test/features/math/simple.js
index ea0cf31..47c269e 100644
--- a/test/features/math/simple.js
+++ b/test/features/math/simple.js
@@ -249,6 +249,20 @@
assert.deepEqual(res.body.detail.error.location.end.column,
12);
});
});
+ it("reject use of \\ce commands without chemistry mode enabled",
function () {
+ return preq.post({
+ uri: baseURL,
+ body: {q: "\\ce{H2O}"}
+ }).then(function (res) {
+ // if we are here, no error was thrown, not good
+ throw new Error('Expected an error to be thrown, got status: '
+ res.status);
+ }, function (res) {
+ assert.status(res, 400);
+ assert.deepEqual(res.body.success, false);
+ assert.deepEqual(res.body.detail.error.found, "\\ce");
+ assert.deepEqual(res.body.error, "SyntaxError: Attempting to
use the $\\ce$ command outside of a chemistry environment.");
+ });
+ });
it("reject invalid input type", function () {
return preq.post({
uri: baseURL,
--
To view, visit https://gerrit.wikimedia.org/r/268869
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I73802b2be2d10e8395c1751eb31930d634be00fa
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits