mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Catch more exceptions in jsonCompiler.
This commit is contained in:
parent
b5d941d3d9
commit
52ee47190d
@ -202,6 +202,8 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
|
|||||||
output["errors"] = errors;
|
output["errors"] = errors;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
output["contracts"] = Json::Value(Json::objectValue);
|
output["contracts"] = Json::Value(Json::objectValue);
|
||||||
for (string const& contractName: compiler.contractNames())
|
for (string const& contractName: compiler.contractNames())
|
||||||
@ -246,8 +248,20 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
|
|||||||
for (auto const& source: compiler.sourceNames())
|
for (auto const& source: compiler.sourceNames())
|
||||||
output["sources"][source]["AST"] = ASTJsonConverter(compiler.ast(source), compiler.sourceIndices()).json();
|
output["sources"][source]["AST"] = ASTJsonConverter(compiler.ast(source), compiler.sourceIndices()).json();
|
||||||
}
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
output["errors"].append("Unknown exception while generating compiler output.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
return Json::FastWriter().write(output);
|
return Json::FastWriter().write(output);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return "{\"errors\":[\"Unknown error while generating JSON.\"]}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string compileMulti(string const& _input, bool _optimize, CStyleReadFileCallback _readCallback = nullptr)
|
string compileMulti(string const& _input, bool _optimize, CStyleReadFileCallback _readCallback = nullptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user