diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-17 20:08:12 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-04-21 02:38:00 +0800 |
commit | 418759ece046798d9c1707bb9992aa43ba194303 (patch) | |
tree | 8316f7ccc2a8fe68ab48559c7e57ae05500814ef /libsolidity | |
parent | 4f3c76364c5f76c42f28fcaeb28f57946545a61a (diff) | |
download | dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar.gz dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar.bz2 dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar.lz dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar.xz dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.tar.zst dexon-solidity-418759ece046798d9c1707bb9992aa43ba194303.zip |
Catch exceptions of StandardCompiler
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/StandardCompiler.cpp | 14 | ||||
-rw-r--r-- | libsolidity/interface/StandardCompiler.h | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index acc5642b..7f3b7a58 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -29,7 +29,7 @@ using namespace std; using namespace dev; using namespace dev::solidity; -Json::Value StandardCompiler::compile(Json::Value const& _input) +Json::Value StandardCompiler::compileInternal(Json::Value const& _input) { m_compilerStack.reset(false); @@ -139,6 +139,18 @@ Json::Value StandardCompiler::compile(Json::Value const& _input) return output; } +Json::Value StandardCompiler::compile(Json::Value const& _input) +{ + try + { + return compileInternal(_input); + } + catch (...) + { + return "{\"errors\":\"[{\"type\":\"InternalCompilerError\",\"component\":\"general\",\"severity\":\"error\",\"message\":\"Internal exception in StandardCompiler::compilerInternal\"}]}"; + } +} + string StandardCompiler::compile(string const& _input) { Json::Value input; diff --git a/libsolidity/interface/StandardCompiler.h b/libsolidity/interface/StandardCompiler.h index c47e3c88..12d85aad 100644 --- a/libsolidity/interface/StandardCompiler.h +++ b/libsolidity/interface/StandardCompiler.h @@ -52,6 +52,8 @@ public: std::string compile(std::string const& _input); private: + Json::Value compileInternal(Json::Value const& _input); + CompilerStack m_compilerStack; }; |