aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/deployer/src/cli.ts5
-rw-r--r--packages/deployer/src/utils/error_reporter.ts13
2 files changed, 16 insertions, 2 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index b131a96d8..176eaf973 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -10,6 +10,7 @@ import * as yargs from 'yargs';
import { commands } from './commands';
import { constants } from './utils/constants';
+import { consoleReporter } from './utils/error_reporter';
import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
const DEFAULT_OPTIMIZER_ENABLED = false;
@@ -142,12 +143,12 @@ function deployCommandBuilder(yargsInstance: any) {
default: DEFAULT_CONTRACTS_LIST,
description: 'comma separated list of contracts to compile',
})
- .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommandAsync)
+ .command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync))
.command(
'deploy',
'deploy a single contract with provided arguments',
deployCommandBuilder,
- onDeployCommandAsync,
+ consoleReporter(onDeployCommandAsync),
)
.help().argv;
})();
diff --git a/packages/deployer/src/utils/error_reporter.ts b/packages/deployer/src/utils/error_reporter.ts
new file mode 100644
index 000000000..b28e4fbbe
--- /dev/null
+++ b/packages/deployer/src/utils/error_reporter.ts
@@ -0,0 +1,13 @@
+import { logUtils } from '@0xproject/utils';
+
+export function consoleReporter<T>(asyncFn: (arg: T) => Promise<void>) {
+ const noThrowFnAsync = async (arg: T) => {
+ try {
+ const result = await asyncFn(arg);
+ return result;
+ } catch (err) {
+ logUtils.log(`${err}`);
+ }
+ };
+ return noThrowFnAsync;
+}