Throw exception to allow fuzzer to report which file it failed on.

This commit is contained in:
chriseth
2019-04-04 14:05:38 +02:00
parent 3795569da6
commit ef413bb0b3
3 changed files with 12 additions and 6 deletions
+6 -4
View File
@@ -42,8 +42,9 @@ void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
Json::Value output;
if (!jsonParseStrict(outputString, output))
{
cout << "Compiler produced invalid JSON output." << endl;
abort();
string msg{"Compiler produced invalid JSON output."};
cout << msg << endl;
throw std::runtime_error(std::move(msg));
}
if (output.isMember("errors"))
for (auto const& error: output["errors"])
@@ -54,8 +55,9 @@ void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
});
if (!invalid.empty())
{
cout << "Invalid error: \"" << error["type"].asString() << "\"" << endl;
abort();
string msg = "Invalid error: \"" + error["type"].asString() + "\"";
cout << msg << endl;
throw std::runtime_error(std::move(msg));
}
}
}