Skip to content

Commit f1b47f1

Browse files
author
Justin Martin
committed
Update main.js
1 parent 5cabd90 commit f1b47f1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

js/main.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,17 @@
212212
var diffs = jsonpatch.compare(leftJson, rightJson);
213213
console.log(diffs);
214214
diffs.forEach(function (diff) {
215-
if (diff.op === 'remove') {
216-
leftInputView.highlightRemoval(diff);
217-
} else if (diff.op === 'add') {
218-
rightInputView.highlightAddition(diff);
219-
} else if (diff.op === 'replace') {
220-
rightInputView.highlightChange(diff);
221-
leftInputView.highlightChange(diff);
215+
try {
216+
if (diff.op === 'remove') {
217+
leftInputView.highlightRemoval(diff);
218+
} else if (diff.op === 'add') {
219+
rightInputView.highlightAddition(diff);
220+
} else if (diff.op === 'replace') {
221+
rightInputView.highlightChange(diff);
222+
leftInputView.highlightChange(diff);
223+
}
224+
} catch(e) {
225+
console.warn('error while trying to highlight diff', e);
222226
}
223227
});
224228
}

0 commit comments

Comments
 (0)