From 198a5dc3f417398d938fa9753489211b706b539b Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 27 Jun 2019 10:04:45 -0400 Subject: [PATCH] fix(@embark/solidity): show a better error message in debug --- packages/embark-contracts-manager/src/index.js | 2 +- packages/embark-solidity/src/index.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/embark-contracts-manager/src/index.js b/packages/embark-contracts-manager/src/index.js index 37d5c3429..471d87814 100644 --- a/packages/embark-contracts-manager/src/index.js +++ b/packages/embark-contracts-manager/src/index.js @@ -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; } diff --git a/packages/embark-solidity/src/index.js b/packages/embark-solidity/src/index.js index 790d619d7..65521c5df 100644 --- a/packages/embark-solidity/src/index.js +++ b/packages/embark-solidity/src/index.js @@ -49,16 +49,19 @@ 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); callback(null, output);