From 001cf4531c74f7961bab26f9f37609e92c2dffc3 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Fri, 1 Jun 2018 13:46:44 -0700 Subject: [PATCH] Leave a future hook for custom solc compile error handling --- nucypher/blockchain/eth/sol/compile.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nucypher/blockchain/eth/sol/compile.py b/nucypher/blockchain/eth/sol/compile.py index 15bd0eadc..19341c2b4 100644 --- a/nucypher/blockchain/eth/sol/compile.py +++ b/nucypher/blockchain/eth/sol/compile.py @@ -2,8 +2,10 @@ import distutils import itertools import os +import solc from os.path import abspath, dirname from solc import install_solc, compile_files +from solc.exceptions import SolcError class SolidityCompiler: @@ -60,11 +62,13 @@ class SolidityCompiler: "zeppelin={}".format(os.path.join(project_root, 'zeppelin')), "proxy={}".format(os.path.join(project_root, 'proxy')), ) - - compiled_sol = compile_files(source_files=source_paths, - import_remappings=remappings, - allow_paths=project_root, - optimize=10) + try: + compiled_sol = compile_files(source_files=source_paths, + import_remappings=remappings, + allow_paths=project_root, + optimize=10) + except SolcError as e: + raise # Cleanup the compiled data keys interfaces = {name.split(':')[-1]: compiled_sol[name] for name in compiled_sol}