Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8d59cc5

Browse files
committedDec 6, 2019
Enhance error message in waitForTermChange
1 parent bf23b15 commit 8d59cc5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎test/src/helper/spawn.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,14 +859,16 @@ export default class CodeChain {
859859
public async waitForTermChange(target: number, timeout?: number) {
860860
const start = Date.now();
861861
while (true) {
862-
const termMetadata = await stake.getTermMetadata(this.sdk);
862+
const termMetadata = (await stake.getTermMetadata(this.sdk))!;
863863
if (termMetadata && termMetadata.currentTermId >= target) {
864864
return termMetadata;
865865
}
866866
await wait(1000);
867867
if (timeout) {
868868
if (Date.now() - start > timeout * 1000) {
869-
throw new Error(`Term didn't changed in ${timeout} s`);
869+
throw new Error(
870+
`Term didn't changed to ${target} in ${timeout} s. It is ${termMetadata.currentTermId} now`
871+
);
870872
}
871873
}
872874
}

0 commit comments

Comments
 (0)
Please sign in to comment.