File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -859,14 +859,16 @@ export default class CodeChain {
859
859
public async waitForTermChange ( target : number , timeout ?: number ) {
860
860
const start = Date . now ( ) ;
861
861
while ( true ) {
862
- const termMetadata = await stake . getTermMetadata ( this . sdk ) ;
862
+ const termMetadata = ( await stake . getTermMetadata ( this . sdk ) ) ! ;
863
863
if ( termMetadata && termMetadata . currentTermId >= target ) {
864
864
return termMetadata ;
865
865
}
866
866
await wait ( 1000 ) ;
867
867
if ( timeout ) {
868
868
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
+ ) ;
870
872
}
871
873
}
872
874
}
You can’t perform that action at this time.
0 commit comments