From f1ef8b710b0dc7c4d70d48df98659b128c8c3425 Mon Sep 17 00:00:00 2001 From: aapsi Date: Sun, 19 Oct 2025 21:48:17 +0530 Subject: [PATCH] Add consistent error handling to all TypeScript scripts - Add .catch() error handling to scripts that were missing it - Ensures all scripts fail gracefully with proper exit codes - Improves consistency across the codebase --- scripts/deploy_account.ts | 5 ++++- scripts/fees.ts | 5 ++++- scripts/get_block.ts | 5 ++++- scripts/multiple_pxe.ts | 5 ++++- scripts/profile_deploy.ts | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/deploy_account.ts b/scripts/deploy_account.ts index 3821cba..d0376a0 100644 --- a/scripts/deploy_account.ts +++ b/scripts/deploy_account.ts @@ -9,4 +9,7 @@ export async function deployAccount() { await deploySchnorrAccount(pxe); } -deployAccount(); +deployAccount().catch((error) => { + console.error("Error:", error); + process.exit(1); +}); diff --git a/scripts/fees.ts b/scripts/fees.ts index 7bca0e5..4aa3025 100644 --- a/scripts/fees.ts +++ b/scripts/fees.ts @@ -157,7 +157,10 @@ async function main() { logger.info(`Transfer paid with fees from Sponsored FPC.`) } -main(); +main().catch((error) => { + console.error("Error:", error); + process.exit(1); +}); // from here: https://github.com/AztecProtocol/aztec-packages/blob/ecbd59e58006533c8885a8b2fadbd9507489300c/yarn-project/end-to-end/src/fixtures/utils.ts#L534 function getL1WalletClient(rpcUrl: string, index: number) { diff --git a/scripts/get_block.ts b/scripts/get_block.ts index 0e0e534..de7d367 100644 --- a/scripts/get_block.ts +++ b/scripts/get_block.ts @@ -11,4 +11,7 @@ async function main() { console.log(await block?.hash()) } -main(); +main().catch((error) => { + console.error("Error:", error); + process.exit(1); +}); diff --git a/scripts/multiple_pxe.ts b/scripts/multiple_pxe.ts index 3e9b61a..9967617 100644 --- a/scripts/multiple_pxe.ts +++ b/scripts/multiple_pxe.ts @@ -136,4 +136,7 @@ async function main() { } -main(); +main().catch((error) => { + console.error("Error:", error); + process.exit(1); +}); diff --git a/scripts/profile_deploy.ts b/scripts/profile_deploy.ts index bbb522a..450b0dc 100644 --- a/scripts/profile_deploy.ts +++ b/scripts/profile_deploy.ts @@ -25,4 +25,7 @@ async function main() { console.dir(profileTx, { depth: 2 }); } -main(); +main().catch((error) => { + console.error("Error:", error); + process.exit(1); +});