Pad: Improve check failure message prefixing
This commit is contained in:
parent
2dbda3fe7e
commit
cad2440e6a
1 changed files with 10 additions and 16 deletions
|
@ -649,9 +649,8 @@ class Pad {
|
||||||
if (k === 'author' && v) authorIds.add(v);
|
if (k === 'author' && v) authorIds.add(v);
|
||||||
});
|
});
|
||||||
let atext = Changeset.makeAText('\n');
|
let atext = Changeset.makeAText('\n');
|
||||||
let r;
|
for (let r = 0; r <= head; ++r) {
|
||||||
try {
|
try {
|
||||||
for (r = 0; r <= head; ++r) {
|
|
||||||
const [changeset, authorId, timestamp] = await Promise.all([
|
const [changeset, authorId, timestamp] = await Promise.all([
|
||||||
this.getRevisionChangeset(r),
|
this.getRevisionChangeset(r),
|
||||||
this.getRevisionAuthor(r),
|
this.getRevisionAuthor(r),
|
||||||
|
@ -683,13 +682,11 @@ class Pad {
|
||||||
if (r === this.getKeyRevisionNumber(r)) {
|
if (r === this.getKeyRevisionNumber(r)) {
|
||||||
assert.deepEqual(await this._getKeyRevisionAText(r), atext);
|
assert.deepEqual(await this._getKeyRevisionAText(r), atext);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const pfx = `(pad ${this.id} revision ${r}) `;
|
err.message = `(pad ${this.id} revision ${r}) ${err.message}`;
|
||||||
if (err.stack) err.stack = pfx + err.stack;
|
|
||||||
err.message = pfx + err.message;
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert.equal(this.text(), atext.text);
|
assert.equal(this.text(), atext.text);
|
||||||
assert.deepEqual(this.atext, atext);
|
assert.deepEqual(this.atext, atext);
|
||||||
assert.deepEqual(this.getAllAuthors().sort(), [...authorIds].sort());
|
assert.deepEqual(this.getAllAuthors().sort(), [...authorIds].sort());
|
||||||
|
@ -697,19 +694,16 @@ class Pad {
|
||||||
assert(this.chatHead != null);
|
assert(this.chatHead != null);
|
||||||
assert(Number.isInteger(this.chatHead));
|
assert(Number.isInteger(this.chatHead));
|
||||||
assert(this.chatHead >= -1);
|
assert(this.chatHead >= -1);
|
||||||
let c;
|
|
||||||
try {
|
|
||||||
for (c = 0; c <= this.chatHead; ++c) {
|
for (c = 0; c <= this.chatHead; ++c) {
|
||||||
|
try {
|
||||||
const msg = await this.getChatMessage(c);
|
const msg = await this.getChatMessage(c);
|
||||||
assert(msg != null);
|
assert(msg != null);
|
||||||
assert(msg instanceof ChatMessage);
|
assert(msg instanceof ChatMessage);
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const pfx = `(pad ${this.id} chat message ${c}) `;
|
err.message = `(pad ${this.id} chat message ${c}) ${err.message}`;
|
||||||
if (err.stack) err.stack = pfx + err.stack;
|
|
||||||
err.message = pfx + err.message;
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await hooks.aCallAll('padCheck', {pad: this});
|
await hooks.aCallAll('padCheck', {pad: this});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue