Skip to content

Commit e8df267

Browse files
committed
fix: try-catch on building
1 parent eae3598 commit e8df267

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

plugin/builder/build-plugin.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const checkGit = async () => {
2828
const moveTxzFile = async (txzPath: string, pluginVersion: string) => {
2929
const txzName = getTxzName(pluginVersion);
3030
await rename(txzPath, join(deployDir, txzName));
31-
}
31+
};
3232

3333
function updateEntityValue(
3434
xmlString: string,
@@ -92,12 +92,17 @@ const buildPlugin = async ({
9292
*/
9393

9494
const main = async () => {
95-
const validatedEnv = await setupPluginEnv(process.argv);
96-
await checkGit();
97-
await cleanupPluginFiles();
95+
try {
96+
const validatedEnv = await setupPluginEnv(process.argv);
97+
await checkGit();
98+
await cleanupPluginFiles();
9899

99-
await buildPlugin(validatedEnv);
100-
await moveTxzFile(validatedEnv.txzPath, validatedEnv.pluginVersion);
100+
await buildPlugin(validatedEnv);
101+
await moveTxzFile(validatedEnv.txzPath, validatedEnv.pluginVersion);
102+
} catch (error) {
103+
console.error(error);
104+
process.exit(1);
105+
}
101106
};
102107

103108
await main();

plugin/builder/build-txz.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,14 @@ const buildTxz = async (validatedEnv: TxzEnv) => {
8888
};
8989

9090
const main = async () => {
91-
const validatedEnv = await setupTxzEnv(process.argv);
92-
await cleanupTxzFiles();
93-
await buildTxz(validatedEnv);
91+
try {
92+
const validatedEnv = await setupTxzEnv(process.argv);
93+
await cleanupTxzFiles();
94+
await buildTxz(validatedEnv);
95+
} catch (error) {
96+
console.error(error);
97+
process.exit(1);
98+
}
9499
};
95100

96101
await main();

0 commit comments

Comments
 (0)