Skip to content

Commit

Permalink
feat: catch errors properly
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Feb 7, 2024
1 parent 9de4b30 commit 0025388
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/contracts/deploy/1_create_repo/10_create_repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import {
getLatestNetworkDeployment,
getNetworkNameByAlias,
} from '@aragon/osx-commons-configs';
import {findEventTopicLog} from '@aragon/osx-commons-sdk';
import {
UnsupportedNetworkError,
findEventTopicLog,
} from '@aragon/osx-commons-sdk';
import {
PluginRepoRegistryEvents,
PluginRepoRegistry__factory,
Expand All @@ -31,12 +34,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

const [deployer] = await hre.ethers.getSigners();
const productionNetworkName = getProductionNetworkName(hre);

// Get the Aragon `PluginRepoFactory` address from the `osx-commons-configs`
// Get the Aragon `PluginRepoFactory` from the `osx-commons-configs`
const productionNetworkName = getProductionNetworkName(hre);
const network = getNetworkNameByAlias(productionNetworkName);
if (network === null) {
throw new UnsupportedNetworkError(productionNetworkName);
}
const networkDeployments = getLatestNetworkDeployment(network);
if (networkDeployments === null) {
throw `Deployments are not available on network ${network}.`;
}
const pluginRepoFactory = PluginRepoFactory__factory.connect(
getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)!
.PluginRepoFactory.address,
networkDeployments.PluginRepoFactory.address,
deployer
);

Expand Down

0 comments on commit 0025388

Please sign in to comment.