Skip to content

Commit

Permalink
Fix oppia#7087: Add log for "contains no units" SyntaxError (oppia#7157)
Browse files Browse the repository at this point in the history
* Fixes oppia#2197 and oppia#2195

* fix e2e error (library)

* Use URL as constants

* Constants in all caps

* Fix linting issue

* adds log for oppia#7087

* address review comment

* address review comment

* log earlierInput
  • Loading branch information
Kevin Thomas authored and seanlip committed Jul 18, 2019
1 parent afde363 commit 1ec3f47
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,17 @@ oppia.factory('NumberWithUnitsValidationService', [
}
var earlierInputString = earlierInput.toMathjsCompatibleString();
var laterInputString = laterInput.toMathjsCompatibleString();
return math.unit(laterInputString).equals(math.unit(
earlierInputString));
try {
return math.unit(laterInputString).equals(math.unit(
earlierInputString));
} catch (e) {
var additionalInfo = (
'\nlaterInput: ' + JSON.stringify(laterInput.toDict()) +
'\nearlierInput: ' + JSON.stringify(earlierInput.toDict())
);
e.message += additionalInfo;
throw e;
}
};

var ranges = [];
Expand Down

0 comments on commit 1ec3f47

Please sign in to comment.