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

This commit is contained in:
Alex Beregszaszi 2020-11-04 14:29:57 +00:00
parent 3c7f642227
commit 9ebd3da3ff
5 changed files with 17 additions and 4 deletions

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.

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;

View File

@ -0,0 +1 @@
--standard-json

View File

@ -0,0 +1 @@
File not found: standard_file_not_found/input.sol

View File

@ -0,0 +1 @@
1