提交 931ee228 编写于 作者: J Joao Moreno

smoketest: poll should report last error

上级 6be579cd
......@@ -149,9 +149,13 @@ async function poll<T>(
retryInterval: number = 100 // millis
): Promise<T> {
let trial = 1;
let lastError: string = '';
while (true) {
if (trial > retryCount) {
console.error('** Timeout!');
console.error(lastError);
throw new Error(`Timeout: ${timeoutMessage} after ${(retryCount * retryInterval) / 1000} seconds.`);
}
......@@ -161,13 +165,11 @@ async function poll<T>(
if (acceptFn(result)) {
return result;
} else {
lastError = 'Did not pass accept function';
}
} catch (e) {
// console.warn(e);
if (/Method not implemented/.test(e.message)) {
throw e;
}
lastError = Array.isArray(e.stack) ? e.stack.join(os.EOL) : e.stack;
}
await new Promise(resolve => setTimeout(resolve, retryInterval));
......
--timeout 20000
--slow 20000
--timeout 60000
--slow 30000
out/main.js
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册