aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-03-29 20:34:16 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-21 02:38:00 +0800
commit4eaee772b3b4afab9d47ab50327fe451ebff22f4 (patch)
treec7caa7cc1fc3413102dbc050815ee4df9ba878c8 /libsolidity/interface
parentf8cb0766d4da0c651999a9e6b9b158216b0a47cb (diff)
downloaddexon-solidity-4eaee772b3b4afab9d47ab50327fe451ebff22f4.tar.gz
dexon-solidity-4eaee772b3b4afab9d47ab50327fe451ebff22f4.tar.zst
dexon-solidity-4eaee772b3b4afab9d47ab50327fe451ebff22f4.zip
Capture error messages from the JSON parser
Diffstat (limited to 'libsolidity/interface')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index e5de39a8..c6a83bab 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -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.\"}]}";
}