mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 21:46:12 +00:00
Simplified error handling
This commit is contained in:
parent
15884309e5
commit
45f7710476
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user