From dbac19179b322edfe2eed16dd4933203c4b9287d Mon Sep 17 00:00:00 2001 From: SpaceManiac Date: Thu, 4 Apr 2024 14:23:09 -0700 Subject: [PATCH] Fix batcher crashing silently (#338) * Fix batcher crashing silently * Add explanatory comment Co-authored-by: Sebastien Guillemot --------- Co-authored-by: Sebastien Guillemot --- packages/batcher/runtime/src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/batcher/runtime/src/index.ts b/packages/batcher/runtime/src/index.ts index 8d8f63d5d..fea9e8d5c 100644 --- a/packages/batcher/runtime/src/index.ts +++ b/packages/batcher/runtime/src/index.ts @@ -189,4 +189,10 @@ async function main(): Promise { await runtime.run(gameInputValidator, batchedTransactionPoster, provider); } -void main(); +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); +});