From ec05b85dd3c0422c1c2660c01e9465af3a30f60a Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Thu, 4 Apr 2024 10:44:28 -0700 Subject: [PATCH 1/2] Fix batcher crashing silently --- packages/batcher/runtime/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/batcher/runtime/src/index.ts b/packages/batcher/runtime/src/index.ts index 8d8f63d5d..3411dee39 100644 --- a/packages/batcher/runtime/src/index.ts +++ b/packages/batcher/runtime/src/index.ts @@ -189,4 +189,7 @@ async function main(): Promise { await runtime.run(gameInputValidator, batchedTransactionPoster, provider); } -void main(); +main().catch(e => { + console.error(e); + process.exit(1); +}); From d3daf098a74475bb130146b36bcf0a69f04a6deb Mon Sep 17 00:00:00 2001 From: SpaceManiac Date: Thu, 4 Apr 2024 14:12:25 -0700 Subject: [PATCH 2/2] Add explanatory comment Co-authored-by: Sebastien Guillemot --- packages/batcher/runtime/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/batcher/runtime/src/index.ts b/packages/batcher/runtime/src/index.ts index 3411dee39..fea9e8d5c 100644 --- a/packages/batcher/runtime/src/index.ts +++ b/packages/batcher/runtime/src/index.ts @@ -190,6 +190,9 @@ async function main(): Promise { } main().catch(e => { + // we catch the error here instead of relying on `uncaughtException` monitoring + // because if an exception causes us to reach this line, it means the error was thrown during initalization + // which is typically something we cannot recover from console.error(e); process.exit(1); });