mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommonIO: Make readFile() check if the file is not a directory and if not fail with a sensible exception rather than std::length_error
This commit is contained in:
@@ -668,6 +668,10 @@ bool CommandLineInterface::parseLibraryOption(string const& _input)
|
||||
{
|
||||
// Should not happen if `fs::is_regular_file` is correct.
|
||||
}
|
||||
catch (NotAFile const&)
|
||||
{
|
||||
// Should not happen if `fs::is_regular_file` is correct.
|
||||
}
|
||||
|
||||
vector<string> libraries;
|
||||
boost::split(libraries, data, boost::is_space() || boost::is_any_of(","), boost::token_compress_on);
|
||||
@@ -1263,6 +1267,11 @@ bool CommandLineInterface::processInput()
|
||||
serr() << "File not found: " << jsonFile << endl;
|
||||
return false;
|
||||
}
|
||||
catch (NotAFile const&)
|
||||
{
|
||||
serr() << "Not a regular file: " << jsonFile << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
StandardCompiler compiler(m_fileReader.reader());
|
||||
sout() << compiler.compile(std::move(input)) << endl;
|
||||
|
||||
Reference in New Issue
Block a user