From d316977bef171a082f00dd39bdb07f591c52e025 Mon Sep 17 00:00:00 2001 From: duckception Date: Tue, 12 Sep 2023 00:10:44 +0200 Subject: [PATCH] add try catch --- commands/foundry.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/commands/foundry.js b/commands/foundry.js index b405a1449..37e00f019 100644 --- a/commands/foundry.js +++ b/commands/foundry.js @@ -13,24 +13,29 @@ module.exports = { return activeChains; }, async forkChains(options) { - // await module.exports.installFoundry(options.foundryCommit); + log('starting to fork chains'); + try { + // await module.exports.installFoundry(options.foundryCommit); - if (typeof options === 'object') { - const chains = await module.exports.runAnvilWithViem( - options.chainsToFork, - ); + if (typeof options === 'object') { + const chains = await module.exports.runAnvilWithViem( + options.chainsToFork, + ); - return { chains }; - } else if (typeof options === 'string') { - if (isNaN(options)) { - // todo: add support for: - // (multiple) network IDs - // (single) network name - // (multiple) network names - } else { - // todo: add support for: - // (single) network ID + return { chains }; + } else if (typeof options === 'string') { + if (isNaN(options)) { + // todo: add support for: + // (multiple) network IDs + // (single) network name + // (multiple) network names + } else { + // todo: add support for: + // (single) network ID + } } + } catch (e) { + throw new Error('Error while forking chains', e); } }, async setupViem(anvilChainType) {