mirror of https://github.com/embarklabs/embark.git
fix(@embark/solidity): show a better error message in debug
This commit is contained in:
parent
7652e1d75c
commit
198a5dc3f4
|
@ -581,7 +581,7 @@ class ContractsManager {
|
||||||
self.compileError = true;
|
self.compileError = true;
|
||||||
self.events.emit("status", __("Compile/Build error"));
|
self.events.emit("status", __("Compile/Build error"));
|
||||||
self.events.emit("outputError", __("Error building Dapp, please check console"));
|
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 {
|
} else {
|
||||||
self.compileError = false;
|
self.compileError = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,16 +49,19 @@ class Solidity {
|
||||||
return callback(output.errors);
|
return callback(output.errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isError = false;
|
||||||
if (output.errors) {
|
if (output.errors) {
|
||||||
for (let i = 0; i < output.errors.length; i++) {
|
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') {
|
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);
|
self.events.emit('contracts:compiled:solc', output);
|
||||||
callback(null, output);
|
callback(null, output);
|
||||||
|
|
Loading…
Reference in New Issue