diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 16:28:27 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 17:35:03 +0800 |
commit | fbc39614c095cfb9b1fd4af5d46362e331879743 (patch) | |
tree | 16781d9b611373ccc85543a297f7b268a9cb76b3 /packages/deployer | |
parent | b2d6ac8dba9dae92e2850fd39f0f7f3f22900cc5 (diff) | |
download | dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar.gz dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar.bz2 dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar.lz dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar.xz dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.tar.zst dexon-0x-contracts-fbc39614c095cfb9b1fd4af5d46362e331879743.zip |
Report errors locally
Diffstat (limited to 'packages/deployer')
-rw-r--r-- | packages/deployer/src/compiler.ts | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts index 4bd636c90..ba360cb57 100644 --- a/packages/deployer/src/compiler.ts +++ b/packages/deployer/src/compiler.ts @@ -45,7 +45,6 @@ export class Compiler { private _artifactsDir: string; // This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be. private _contractSources!: ContractSources; - private _solcErrors: Set<string> = new Set(); private _specifiedContracts: Set<string> = new Set(); private _contractSourceData: ContractSourceData = {}; /** @@ -114,9 +113,6 @@ export class Compiler { for (const fileName of fileNames) { await this._compileContractAsync(fileName); } - this._solcErrors.forEach(errMsg => { - logUtils.log(errMsg); - }); } /** * Compiles contract and saves artifact to artifactsDir. @@ -181,13 +177,20 @@ export class Compiler { if (!_.isUndefined(compiled.errors)) { const SOLIDITY_WARNING_PREFIX = 'Warning'; const isError = (errorOrWarning: string) => !errorOrWarning.includes(SOLIDITY_WARNING_PREFIX); + const isWarning = (errorOrWarning: string) => errorOrWarning.includes(SOLIDITY_WARNING_PREFIX); const errors = _.filter(compiled.errors, isError); - _.forEach(compiled.errors, errMsg => { - const normalizedErrMsg = getNormalizedErrMsg(errMsg); - this._solcErrors.add(normalizedErrMsg); - }); + const warnings = _.filter(compiled.errors, isWarning); if (!_.isEmpty(errors)) { - return; + errors.forEach(errMsg => { + const normalizedErrMsg = getNormalizedErrMsg(errMsg); + logUtils.log(normalizedErrMsg); + }); + process.exit(1); + } else { + warnings.forEach(errMsg => { + const normalizedErrMsg = getNormalizedErrMsg(errMsg); + logUtils.log(normalizedErrMsg); + }); } } const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION); |