diff --git a/src/integration/blockchain/polygon/polygon-client.ts b/src/integration/blockchain/polygon/polygon-client.ts index c66a73681a..d479fd80f0 100644 --- a/src/integration/blockchain/polygon/polygon-client.ts +++ b/src/integration/blockchain/polygon/polygon-client.ts @@ -33,7 +33,9 @@ export class PolygonClient extends EvmClient implements L2BridgeEvmClient { const { polygonWalletAddress } = GetConfig().blockchain.polygon; this.posClient = new POSClient(); - void this.initPolygonNetwork(ethWalletAddress, polygonWalletAddress); + this.initPolygonNetwork(ethWalletAddress, polygonWalletAddress).catch((e) => + this.logger.error('Polygon network initialization failed:', e), + ); this.l2TxIdCache = new Set(); } diff --git a/src/main.ts b/src/main.ts index 7097c291b4..4b6f48436a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -37,6 +37,14 @@ process.on('uncaughtException', (error) => { process.exit(1); }); +process.on('unhandledRejection', (reason) => { + const logger = new DfxLogger('UnhandledRejection'); + logger.error( + 'Unhandled promise rejection (process kept alive):', + reason instanceof Error ? reason : new Error(String(reason)), + ); +}); + async function bootstrap() { if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) { AppInsights.setup().setAutoDependencyCorrelation(true).setAutoCollectConsole(true, true);