From f0c257ceb420f1d6fb4513ff9ef8c7c773b6e333 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 5 Jan 2021 13:34:09 -0800 Subject: [PATCH] fix: add placeholder for top-of-turn error logging (#2163) --- packages/eventual-send/src/track-turns.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/eventual-send/src/track-turns.js b/packages/eventual-send/src/track-turns.js index f4330cf2919..9cbab543aad 100644 --- a/packages/eventual-send/src/track-turns.js +++ b/packages/eventual-send/src/track-turns.js @@ -14,6 +14,9 @@ let hiddenPriorError; let hiddenCurrentTurn = 0; let hiddenCurrentEvent = 0; +// Turn on if you seem to be losing error logging at the top of the event loop +const VERBOSE = false; + /** * @typedef {((...args: any[]) => any) | void} TurnStarterFn * An optional function that is not this-sensitive, expected to be called at @@ -66,6 +69,9 @@ export const trackTurns = funcs => { d`Thrown from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`, ); } + if (VERBOSE) { + console.log('THROWN to top of event loop', err); + } throw err; } // Must capture this now, not when the catch triggers. @@ -74,6 +80,9 @@ export const trackTurns = funcs => { if (reason instanceof Error) { assert.note(reason, detailsNote); } + if (VERBOSE) { + console.log('REJECTED at top of event loop', reason); + } }); return result; } finally {