mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Capture error messages from the JSON parser
This commit is contained in:
parent
f8cb0766d4
commit
4eaee772b3
@ -178,15 +178,21 @@ Json::Value StandardCompiler::compile(Json::Value const& _input)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return "{\"errors\":\"[{\"type\":\"InternalCompilerError\",\"component\":\"general\",\"severity\":\"error\",\"message\":\"Internal exception in StandardCompiler::compilerInternal\"}]}";
|
||||
return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compilerInternal");
|
||||
}
|
||||
}
|
||||
|
||||
string StandardCompiler::compile(string const& _input)
|
||||
{
|
||||
Json::Value input;
|
||||
Json::Reader reader;
|
||||
|
||||
if (!Json::Reader().parse(_input, input, false))
|
||||
try
|
||||
{
|
||||
if (!reader.parse(_input, input, false))
|
||||
return jsonCompactPrint(formatFatalError("JSONError", reader.getFormattedErrorMessages()));
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return "{\"errors\":\"[{\"type\":\"JSONError\",\"component\":\"general\",\"severity\":\"error\",\"message\":\"Error parsing input JSON.\"}]}";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user