Skip to content

Commit

Permalink
Add logging for oppia#6702, oppia#6604 (oppia#6833)
Browse files Browse the repository at this point in the history
* add logging for guppy error, and filter expression error

* fix lint

* fix merge and review comments
  • Loading branch information
nithusha21 authored and seanlip committed Jun 15, 2019
1 parent 3069fe6 commit 9658729
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

oppia.filter('removeDuplicatesInArray', [function() {
return function(input) {
if (!input.filter) {
throw Error(
'Bad input for removeDuplicatesInArray: ' + JSON.stringify(input));
}
return input.filter(function(val, pos) {
return input.indexOf(val) === pos;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
oppia.factory('MathExpressionInputRulesService', [function() {
return {
IsMathematicallyEquivalentTo: function(answer, inputs) {
try {
MathExpression.fromLatex(answer.latex);
} catch (e) {
throw Error(
'Bad expression in answer.latex: ' + e.message() + ' inputs: ' +
JSON.stringify(answer));
}

try {
MathExpression.fromLatex(inputs.x);
} catch (e) {
throw Error(
'Bad expression in inputs.x: ' + e.message() + ' inputs: ' +
JSON.stringify(inputs));
}

return (
MathExpression.fromLatex(answer.latex).equals(
MathExpression.fromLatex(inputs.x)));
Expand Down

0 comments on commit 9658729

Please sign in to comment.