From 783bc873db04a9f712300e57a346ce803b85590c Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 13 Aug 2018 23:09:07 -0700 Subject: extract method _verifyAndPersistCompilationAsync() --- packages/sol-compiler/src/compiler.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'packages/sol-compiler/src/compiler.ts') diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 83caa2a19..f301b697b 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -176,6 +176,23 @@ export class Compiler { settings: this._compilerSettings, }; const compiled: solc.StandardOutput = this._compile(solcInstance, standardInput); + return this._verifyAndPersistCompilationAsync( + contractSource, + contractName, + fullSolcVersion, + compiled, + sourceTreeHashHex, + currentArtifactIfExists, + ); + } + private async _verifyAndPersistCompilationAsync( + contractSource: { path: string }, + contractName: string, + fullSolcVersion: string, + compiled: solc.StandardOutput, + sourceTreeHashHex: string, + currentArtifactIfExists: ContractArtifact | void, + ): Promise { const compiledData = compiled.contracts[contractSource.path][contractName]; if (_.isUndefined(compiledData)) { throw new Error( @@ -251,7 +268,7 @@ export class Compiler { const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message); logUtils.log(chalk.red(normalizedErrMsg)); }); - throw new Error("Compilation errors encountered"); + throw new Error('Compilation errors encountered'); } else { warnings.forEach(warning => { const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message); -- cgit v1.2.3