[CLI] Report error nicely if writing a file failed

This commit is contained in:
Alex Beregszaszi 2020-11-04 16:19:38 +00:00
parent 9ebd3da3ff
commit d115c30dde
2 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,7 @@ Language Features:
Compiler Features:
* Command Line Interface: Report error if file could not be read in ``--standard-json`` mode.
* Command Line interface: Report proper error for each output file which could not be written. Previously an exception was thrown, and execution aborted, on the first error.
* 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,8 +84,6 @@ using namespace solidity;
using namespace solidity::util;
using namespace solidity::langutil;
DEV_SIMPLE_EXCEPTION(FileError);
namespace po = boost::program_options;
namespace solidity::frontend
@ -745,7 +743,11 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da
ofstream outFile(pathName);
outFile << _data;
if (!outFile)
BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + pathName));
{
serr() << "Could not write to file \"" << pathName << "\"." << endl;
m_error = true;
return;
}
}
void CommandLineInterface::createJson(string const& _fileName, string const& _json)