From 2d1d9994add56f3eaee5eeaba4b0f065ce8a3b47 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 14 May 2018 09:42:29 -0400 Subject: [PATCH] Simplified error handling --- lib/cmds/scaffolding.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/cmds/scaffolding.js b/lib/cmds/scaffolding.js index 73416d93..57d8ea86 100644 --- a/lib/cmds/scaffolding.js +++ b/lib/cmds/scaffolding.js @@ -1,7 +1,3 @@ -const commandName = "generate-ui"; - -const errorMessage = (message) => new Error(commandName + ": " + message); - class Scaffolding { constructor(embark, options){ this.embark = embark; @@ -28,23 +24,18 @@ class Scaffolding { } }); }); - + if(build === null){ - throw errorMessage("Could not find plugin for framework '" + this.framework + "'"); + throw new Error("Could not find plugin for framework '" + this.framework + "'"); } if(!this.isContract(contractName)){ - return errorMessage("contract '" + contractName + "' does not exist"); + return new Error("contract '" + contractName + "' does not exist"); } const contract = contractConfiguration.contracts[contractName]; - - try { - let result = build(contract); - this.embark.logger.info(result); - } catch(err){ - throw errorMessage(err); - } + const result = build(contract); + this.embark.logger.info(result); } }