[CLI] Report error on missing file for --standard-json

This commit is contained in:
Alex Beregszaszi committed 2020-11-04 16:35:19 +00:00
1 parent 3c7f642227
commit 9ebd3da3ff
5 files changed
+17 -4

No files matched your search

+13 -4
View File
@@ -84,10 +84,10 @@ using namespace solidity;
using namespace solidity::util;
using namespace solidity::langutil;
namespace po = boost::program_options;
DEV_SIMPLE_EXCEPTION(FileError);
namespace po = boost::program_options;
namespace solidity::frontend
{
@@ -1240,8 +1240,17 @@ bool CommandLineInterface::processInput()
if (jsonFile.empty())
input = readStandardInput();
else
// TODO: handle FileNotFound exception
input = readFileAsString(jsonFile);
{
try
{
input = readFileAsString(jsonFile);
}
catch (FileNotFound const&)
{
serr() << "File not found: " << jsonFile << endl;
return false;
}
}
StandardCompiler compiler(fileReader);
sout() << compiler.compile(std::move(input)) << endl;
return true;