Simplified error handling
This commit is contained in:
parent
152cf4c87b
commit
2d1d9994ad
|
@ -1,7 +1,3 @@
|
|||
const commandName = "generate-ui";
|
||||
|
||||
const errorMessage = (message) => new Error(commandName + ": " + message);
|
||||
|
||||
class Scaffolding {
|
||||
constructor(embark, options){
|
||||
this.embark = embark;
|
||||
|
@ -30,21 +26,16 @@ 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);
|
||||
const result = build(contract);
|
||||
this.embark.logger.info(result);
|
||||
} catch(err){
|
||||
throw errorMessage(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue