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

This commit is contained in:
Alex Beregszaszi
2020-11-04 16:35:19 +00:00
parent 3c7f642227
commit 9ebd3da3ff
5 changed files with 17 additions and 4 deletions
+1
View File
@@ -4,6 +4,7 @@ Language Features:
* Ability to select the abi coder using ``pragma abicoder v1`` and ``pragma abicoder v2``.
Compiler Features:
* Command Line Interface: Report error if file could not be read in ``--standard-json`` mode.
* SMTChecker: Add division by zero checks in the CHC engine.
* SMTChecker: Support ``selector`` for expressions with value known at compile-time.
* Command Line Interface: New option ``--model-checker-timeout`` sets a timeout in milliseconds for each individual query performed by the SMTChecker.
+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;
@@ -0,0 +1 @@
--standard-json
@@ -0,0 +1 @@
File not found: standard_file_not_found/input.sol
@@ -0,0 +1 @@
1