From d845ba057a597e8d7accfd3a3ca0a55afb0aabf3 Mon Sep 17 00:00:00 2001 From: glendc Date: Mon, 30 Jan 2023 23:55:11 +0100 Subject: [PATCH] improve error logging for JS/TS ping test helps debugging issues in case things go haywire while testing the JS implementation --- multidim-interop/js/v0.41/test/ping.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/multidim-interop/js/v0.41/test/ping.spec.ts b/multidim-interop/js/v0.41/test/ping.spec.ts index 889fb1ca9..4bf26ad40 100644 --- a/multidim-interop/js/v0.41/test/ping.spec.ts +++ b/multidim-interop/js/v0.41/test/ping.spec.ts @@ -83,7 +83,7 @@ describe('ping test', () => { try { if (isDialer) { - const otherMa = (await redisProxy(["BLPOP", "listenerAddr", timeoutSecs]).catch(err => { throw new Error("Failed to wait for listener") }))[1] + const otherMa = (await redisProxy(["BLPOP", "listenerAddr", timeoutSecs]).catch(err => { throw new Error(`Failed to wait for listener: ${err}`) }))[1] console.log(`node ${node.peerId} pings: ${otherMa}`) const rtt = await node.ping(multiaddr(otherMa)) console.log(`Ping successful: ${rtt}`) @@ -99,6 +99,13 @@ describe('ping test', () => { throw new Error("Failed to wait for dialer to finish") } } + } catch (err: any) { + if (err instanceof AggregateError) { + console.error(`unexpected exception in ping test: ${err}\n Errors: ${err.errors}`) + } else { + console.error(`unexpected exception in ping test: ${err}`) + } + throw err } finally { try { // We don't care if this fails