Skip to content

Commit 1e276bc

Browse files
committed
feat(cli): Verbose error for push functions
1 parent 7ad2564 commit 1e276bc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

templates/cli/lib/commands/push.js.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
10221022
let successfullyPushed = 0;
10231023
let successfullyDeployed = 0;
10241024
const failedDeployments = [];
1025+
const errors = [];
10251026

10261027
await Promise.all(functions.map(async (func) => {
10271028
let response = {};
@@ -1071,6 +1072,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
10711072
if (Number(e.code) === 404) {
10721073
functionExists = false;
10731074
} else {
1075+
errors.push(e);
10741076
updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
10751077
return;
10761078
}
@@ -1098,6 +1100,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
10981100

10991101
updaterRow.update({ status: 'Created' });
11001102
} catch (e) {
1103+
errors.push(e)
11011104
updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
11021105
return;
11031106
}
@@ -1159,6 +1162,8 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
11591162
deploymentCreated = true;
11601163
successfullyPushed++;
11611164
} catch (e) {
1165+
errors.push(e);
1166+
11621167
switch (e.code) {
11631168
case 'ENOENT':
11641169
updaterRow.fail({ errorMessage: 'Not found in the current directory. Skipping...' })
@@ -1216,6 +1221,7 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
12161221
await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
12171222
}
12181223
} catch (e) {
1224+
errors.push(e);
12191225
updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' })
12201226
}
12211227
}
@@ -1243,6 +1249,12 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
12431249
} else {
12441250
success(`Successfully pushed ${successfullyPushed} functions.`);
12451251
}
1252+
1253+
if (cliConfig.verbose) {
1254+
errors.forEach(e => {
1255+
console.error(e);
1256+
})
1257+
}
12461258
}
12471259

12481260
const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {

0 commit comments

Comments
 (0)