Simplified error handling
This commit is contained in:
parent
995b067f63
commit
6dfd31639a
|
@ -1,7 +1,3 @@
|
||||||
const commandName = "generate-ui";
|
|
||||||
|
|
||||||
const errorMessage = (message) => new Error(commandName + ": " + message);
|
|
||||||
|
|
||||||
class Scaffolding {
|
class Scaffolding {
|
||||||
constructor(embark, options){
|
constructor(embark, options){
|
||||||
this.embark = embark;
|
this.embark = embark;
|
||||||
|
@ -28,23 +24,18 @@ class Scaffolding {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if(build === null){
|
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)){
|
if(!this.isContract(contractName)){
|
||||||
return errorMessage("contract '" + contractName + "' does not exist");
|
return new Error("contract '" + contractName + "' does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
const contract = contractConfiguration.contracts[contractName];
|
const contract = contractConfiguration.contracts[contractName];
|
||||||
|
const result = build(contract);
|
||||||
try {
|
this.embark.logger.info(result);
|
||||||
let result = build(contract);
|
|
||||||
this.embark.logger.info(result);
|
|
||||||
} catch(err){
|
|
||||||
throw errorMessage(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue