fix(web-app-docs): keep the poll failure attached to the transport error

pollStatus catches an expect.poll failure, appends the last transport error
it saw and throws a fresh Error. Without a cause the original failure and its
stack were dropped, so a Playwright report showed the composed text and no
longer what the poll actually tripped over, which is the interesting half on
a Tor run. eslint's preserve-caught-error was the only error in lint-javascript.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-26 05:08:52 +02:00
1 parent 227552edae
commit 69a86b0f17
1 file changed
+4 -1
@@ -29,7 +29,10 @@ async function pollStatus(request, url, expected, message, timeout) {
.toBe(expected);
} catch (failure) {
if (!lastTransportError) throw failure;
throw new Error(`${failure.message}\nlast transport error reaching ${url}: ${lastTransportError.message}`);
throw new Error(
`${failure.message}\nlast transport error reaching ${url}: ${lastTransportError.message}`,
{ cause: failure },
);
}
}