Catch exceptions of StandardCompiler

This commit is contained in:
Alex Beregszaszi 2017-03-17 12:08:12 +00:00
parent 4f3c76364c
commit 418759ece0
2 changed files with 15 additions and 1 deletions

View File

@ -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;

View File

@ -52,6 +52,8 @@ public:
std::string compile(std::string const& _input);
private:
Json::Value compileInternal(Json::Value const& _input);
CompilerStack m_compilerStack;
};