| 28 | } |
| 29 | |
| 30 | async function runCommand(command: () => Promise<any>) { |
| 31 | const goCommand = await go(command); |
| 32 | if (!goCommand.success) { |
| 33 | logger.consoleLog('\n\n\nError details:'); |
| 34 | |
| 35 | // Logging an error here likely results in excessive logging since the errors are usually logged at the place where they |
| 36 | // happen. However if we do not log the error here we risk having unhandled silent errors. The risk is not worth it. |
| 37 | if (goCommand.error instanceof MultiMessageError) { |
| 38 | goCommand.error.messages.forEach((m) => logger.fail(m)); |
| 39 | } else { |
| 40 | logger.fail(goCommand.error.message); |
| 41 | } |
| 42 | |
| 43 | // eslint-disable-next-line functional/immutable-data |
| 44 | process.exitCode = 1; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | const cliExamples = [ |
| 49 | 'deploy -c config/config.json -s config/secrets.env -r config/receipt.json -l config/logs/', |