mirror of https://github.com/embarklabs/embark.git
fix error display with refactored compilation module
This commit is contained in:
parent
d44a68f176
commit
c500bb4988
|
@ -19,6 +19,7 @@ var Compiler = function(options) {
|
|||
};
|
||||
|
||||
Compiler.prototype.compile_contracts = function(contractFiles, cb) {
|
||||
var self = this;
|
||||
|
||||
var available_compilers = {
|
||||
//".se": this.compile_serpent
|
||||
|
@ -45,13 +46,13 @@ Compiler.prototype.compile_contracts = function(contractFiles, cb) {
|
|||
return (file.filename.match(/\.[0-9a-z]+$/)[0] === extension);
|
||||
});
|
||||
|
||||
compiler.call(compiler, matchingFiles || [], function(compileResult) {
|
||||
compiler.call(compiler, matchingFiles || [], function(err, compileResult) {
|
||||
Object.assign(compiledObject, compileResult);
|
||||
callback();
|
||||
callback(err, compileResult);
|
||||
});
|
||||
},
|
||||
function (err) {
|
||||
cb(compiledObject);
|
||||
cb(err, compiledObject);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -84,10 +85,9 @@ Compiler.prototype.compile_solidity = function(contractFiles, cb) {
|
|||
function compileContracts(callback) {
|
||||
self.logger.info("compiling contracts...");
|
||||
solcW.compile({sources: input}, 1, function(output) {
|
||||
// TODO: check error is handled properly
|
||||
//if (output.errors) {
|
||||
// throw new Error ("Solidity errors: " + output.errors);
|
||||
//}
|
||||
if (output.errors) {
|
||||
return callback(new Error ("Solidity errors: " + output.errors).message);
|
||||
}
|
||||
callback(null, output);
|
||||
});
|
||||
},
|
||||
|
@ -109,7 +109,7 @@ Compiler.prototype.compile_solidity = function(contractFiles, cb) {
|
|||
callback(null, compiled_object);
|
||||
}
|
||||
], function(err, result) {
|
||||
cb(result);
|
||||
cb(err, result);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -40,15 +40,10 @@ ContractsManager.prototype.build = function(done) {
|
|||
async.waterfall([
|
||||
function compileContracts(callback) {
|
||||
var compiler = new Compiler({plugins: self.plugins, logger: self.logger});
|
||||
// TODO: check if try is still needed
|
||||
//try {
|
||||
compiler.compile_contracts(self.contractFiles, function(compiledObject) {
|
||||
compiler.compile_contracts(self.contractFiles, function(err, compiledObject) {
|
||||
self.compiledContracts = compiledObject;
|
||||
callback();
|
||||
callback(err);
|
||||
});
|
||||
//} catch(err) {
|
||||
// return callback(new Error(err.message));
|
||||
//}
|
||||
},
|
||||
function prepareContractsFromConfig(callback) {
|
||||
var className, contract;
|
||||
|
@ -169,13 +164,11 @@ ContractsManager.prototype.build = function(done) {
|
|||
callback();
|
||||
}
|
||||
], function(err, result) {
|
||||
self.logger.trace("finished".underline);
|
||||
if (err) {
|
||||
//self.logger.debug(err.stack);
|
||||
done(err);
|
||||
} else {
|
||||
done(null, self);
|
||||
self.logger.error("Error Compiling/Building contracts: " + err);
|
||||
}
|
||||
self.logger.trace("finished".underline);
|
||||
done(err, self);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue