fix(@embark/solidity): show a better error message in debug

This commit is contained in:
Jonathan Rainville 2019-06-27 10:04:45 -04:00 committed by Michael Bradley
parent 7652e1d75c
commit 198a5dc3f4
2 changed files with 8 additions and 5 deletions

View File

@ -581,7 +581,7 @@ class ContractsManager {
self.compileError = true;
self.events.emit("status", __("Compile/Build error"));
self.events.emit("outputError", __("Error building Dapp, please check console"));
self.logger.error(__("Error Compiling/Building contracts: ") + err);
self.logger.error(__("Error Compiling/Building contracts"));
} else {
self.compileError = false;
}

View File

@ -49,15 +49,18 @@ class Solidity {
return callback(output.errors);
}
let isError = false;
if (output.errors) {
for (let i = 0; i < output.errors.length; i++) {
if (output.errors[i].type === 'Warning') {
self.logger.warn(output.errors[i].formattedMessage);
}
if (output.errors[i].type === 'Error' || output.errors[i].severity === 'error') {
return callback(new Error("Solidity errors: " + output.errors[i].formattedMessage).message);
isError = true;
}
self.logger.warn(output.errors[i].formattedMessage);
self.logger.debug(output.errors[i].message); // Print more error information in debug
}
}
if (isError) {
return callback(__("You have solidity errors. Fix them before moving on."));
}
self.events.emit('contracts:compiled:solc', output);