Skip to content

Commit

Permalink
fix: add placeholder for top-of-turn error logging (#2163)
Browse files Browse the repository at this point in the history
  • Loading branch information
erights authored Jan 5, 2021
1 parent b893a73 commit f0c257c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/eventual-send/src/track-turns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand Down

0 comments on commit f0c257c

Please sign in to comment.