log vyper errors

This commit is contained in:
Jonathan Rainville 2018-08-14 11:18:41 -04:00 committed by Iuri Matias
parent 926ed7c258
commit 0b171401c6
1 changed files with 7 additions and 5 deletions

View File

@ -14,13 +14,15 @@ class Vyper {
embark.registerCompiler(".vy", this.compile_vyper.bind(this)); embark.registerCompiler(".vy", this.compile_vyper.bind(this));
} }
static compileVyperContract(filename, compileABI, callback) { compileVyperContract(filename, compileABI, callback) {
const params = compileABI ? '-f json ' : ''; const self = this;
const params = compileABI ? '-f=json ' : '';
shelljs.exec(`vyper ${params}${filename}`, {silent: true}, (code, stdout, stderr) => { shelljs.exec(`vyper ${params}${filename}`, {silent: true}, (code, stdout, stderr) => {
if (stderr) { if (stderr) {
return callback(stderr); return callback(stderr);
} }
if (code !== 0) { if (code !== 0) {
self.logger.error(stdout);
return callback(__('Vyper exited with error code ') + code); return callback(__('Vyper exited with error code ') + code);
} }
if (!stdout) { if (!stdout) {
@ -31,7 +33,7 @@ class Vyper {
} }
compile_vyper(contractFiles, cb) { compile_vyper(contractFiles, cb) {
let self = this; const self = this;
if (!contractFiles || !contractFiles.length) { if (!contractFiles || !contractFiles.length) {
return cb(); return cb();
} }
@ -51,7 +53,7 @@ class Vyper {
compiled_object[className] = {}; compiled_object[className] = {};
async.parallel([ async.parallel([
function getByteCode(paraCb) { function getByteCode(paraCb) {
Vyper.compileVyperContract(file.filename, false, (err, byteCode) => { self.compileVyperContract(file.filename, false, (err, byteCode) => {
if (err) { if (err) {
return paraCb(err); return paraCb(err);
} }
@ -62,7 +64,7 @@ class Vyper {
}); });
}, },
function getABI(paraCb) { function getABI(paraCb) {
Vyper.compileVyperContract(file.filename, true, (err, ABIString) => { self.compileVyperContract(file.filename, true, (err, ABIString) => {
if (err) { if (err) {
return paraCb(err); return paraCb(err);
} }