diff options
author | chriseth <chris@ethereum.org> | 2017-04-25 16:45:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 16:45:59 +0800 |
commit | c3b839ca751bd11a5881fea1db1cfa92ec468d16 (patch) | |
tree | 2732dda57ee50ec0ac138c6487b802e8cf51511c /libsolidity | |
parent | 4d111e3366c9ddf15a750569baeed3fccb201682 (diff) | |
parent | 5e7a643051b67c43eaaab69dce6c99a503a44820 (diff) | |
download | dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar.gz dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar.bz2 dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar.lz dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar.xz dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.tar.zst dexon-solidity-c3b839ca751bd11a5881fea1db1cfa92ec468d16.zip |
Merge pull request #2164 from ethereum/jsonio-catch-internal-exceptions
JSON IO catch internal exceptions
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/StandardCompiler.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 2b280dd5..2b5e861b 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -181,6 +181,10 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) for (auto const& sourceName: sources.getMemberNames()) { string hash; + + if (!sources[sourceName].isObject()) + return formatFatalError("JSONError", "Source input is not a JSON object."); + if (sources[sourceName]["keccak256"].isString()) hash = sources[sourceName]["keccak256"].asString(); @@ -454,6 +458,14 @@ Json::Value StandardCompiler::compile(Json::Value const& _input) { return compileInternal(_input); } + catch (Json::LogicError const& _exception) + { + return formatFatalError("InternalCompilerError", string("JSON logic exception: ") + _exception.what()); + } + catch (Json::RuntimeError const& _exception) + { + return formatFatalError("InternalCompilerError", string("JSON runtime exception: ") + _exception.what()); + } catch (Exception const& _exception) { return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compileInternal: " + boost::diagnostic_information(_exception)); |