Polish the error messages of the easysync lib

pull/1928/head
Marcel Klehr 2013-10-10 20:02:13 +02:00
parent d86d99bc16
commit 46511d6144
1 changed files with 7 additions and 7 deletions

View File

@ -42,15 +42,15 @@ exports.error = function error(msg) {
};
/**
* This method is user for assertions with Messages
* if assert fails, the error function called.
* This method is used for assertions with Messages
* if assert fails, the error function is called.
* @param b {boolean} assertion condition
* @param msgParts {string} error to be passed if it fails
*/
exports.assert = function assert(b, msgParts) {
if (!b) {
var msg = Array.prototype.slice.call(arguments, 1).join('');
exports.error("exports: " + msg);
exports.error("Failed assertion: " + msg);
}
};
@ -281,7 +281,7 @@ exports.checkRep = function (cs) {
assem.endDocument();
var normalized = exports.pack(oldLen, calcNewLen, assem.toString(), charBank);
exports.assert(normalized == cs, normalized, ' != ', cs);
exports.assert(normalized == cs, 'Invalid changeset (checkRep failed)');
return cs;
}
@ -1296,7 +1296,7 @@ exports.compose = function (cs1, cs2, pool) {
var unpacked2 = exports.unpack(cs2);
var len1 = unpacked1.oldLen;
var len2 = unpacked1.newLen;
exports.assert(len2 == unpacked2.oldLen, "mismatched composition");
exports.assert(len2 == unpacked2.oldLen, "mismatched composition of two changesets");
var len3 = unpacked2.newLen;
var bankIter1 = exports.stringIterator(unpacked1.charBank);
var bankIter2 = exports.stringIterator(unpacked2.charBank);
@ -2010,7 +2010,7 @@ exports.follow = function (cs1, cs2, reverseInsertOrder, pool) {
var unpacked2 = exports.unpack(cs2);
var len1 = unpacked1.oldLen;
var len2 = unpacked2.oldLen;
exports.assert(len1 == len2, "mismatched follow");
exports.assert(len1 == len2, "mismatched follow - cannot transform cs1 on top of cs2");
var chars1 = exports.stringIterator(unpacked1.charBank);
var chars2 = exports.stringIterator(unpacked2.charBank);
@ -2190,7 +2190,7 @@ exports.composeWithDeletions = function (cs1, cs2, pool) {
var unpacked2 = exports.unpack(cs2);
var len1 = unpacked1.oldLen;
var len2 = unpacked1.newLen;
exports.assert(len2 == unpacked2.oldLen, "mismatched composition");
exports.assert(len2 == unpacked2.oldLen, "mismatched composition of two changesets");
var len3 = unpacked2.newLen;
var bankIter1 = exports.stringIterator(unpacked1.charBank);
var bankIter2 = exports.stringIterator(unpacked2.charBank);