Skip to content

Commit d797580

Browse files
committed
fix: Throw original error
1 parent 4b0b4e1 commit d797580

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

index.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ for (const [field, isRequired] of entries(fields)) {
3838

3939
console.log('Starting deploy to Git...');
4040
console.log(`Cloning the repository to "${config.folder}" folder...`);
41-
try {
42-
execSync(`git clone -b ${config.branch} ${config.repository} ${config.folder} 2>&1`, { cwd });
43-
} catch (e) {
44-
console.error('Failed to clone. An original error is thrown below.');
45-
throw Error(e);
46-
}
4741

42+
execSync(`git clone -b ${config.branch} ${config.repository} ${config.folder}`, { cwd });
4843

4944
console.log(`Starting script "${config.script}"...`);
5045
console.log(execSync(`${config.script}`, { cwd }).toString('utf-8'));
@@ -55,33 +50,23 @@ execSync(`
5550
git config user.email "${config.user_email}" &&
5651
git config user.name "${config.user_name}" &&
5752
git add . &&
58-
git commit --allow-empty -m "${config.commit}" 2>&1
53+
git commit --allow-empty -m "${config.commit}"
5954
`, { cwd });
6055

6156
if (config.beforePushScript) {
6257
console.log('Running beforePushScript...');
6358

64-
try {
65-
execSync(`
66-
cd ${config.folder} &&
67-
${config.beforePushScript}
68-
`, { cwd });
69-
} catch (e) {
70-
console.error('Failed to run beforePushScript. An original error is thrown below.');
71-
throw Error(e);
72-
}
73-
}
74-
75-
console.log('Pushing...');
76-
try {
7759
execSync(`
7860
cd ${config.folder} &&
79-
git push --tags ${config.repository} ${config.branch} 2>&1
61+
${config.beforePushScript}
8062
`, { cwd });
81-
} catch (e) {
82-
console.error('Failed to push. An original error is thrown below.');
83-
throw Error(e);
8463
}
8564

65+
console.log('Pushing...');
66+
67+
execSync(`
68+
cd ${config.folder} &&
69+
git push --tags ${config.repository} ${config.branch}
70+
`, { cwd });
8671

8772
console.log('Deploying to git is finished.');

0 commit comments

Comments
 (0)