[yul-phaser] Move handling of boost::program_options::error to the top-level exception handler

This commit is contained in:
Kamil Śliwak 2020-02-28 03:47:00 +01:00
parent 4e90c598b3
commit 53803801f7
2 changed files with 11 additions and 11 deletions

View File

@ -205,17 +205,9 @@ Phaser::CommandLineParsingResult Phaser::parseCommandLine(int _argc, char** _arg
po::variables_map arguments;
po::notify(arguments);
try
{
po::command_line_parser parser(_argc, _argv);
parser.options(keywordDescription).positional(positionalDescription);
po::store(parser.run(), arguments);
}
catch (po::error const & _exception)
{
cerr << _exception.what() << endl;
return {1, move(arguments)};
}
po::command_line_parser parser(_argc, _argv);
parser.options(keywordDescription).positional(positionalDescription);
po::store(parser.run(), arguments);
if (arguments.count("help") > 0)
{

View File

@ -28,6 +28,14 @@ int main(int argc, char** argv)
{
return solidity::phaser::Phaser::main(argc, argv);
}
catch (boost::program_options::error const& exception)
{
// Bad input data. Invalid command-line parameters.
std::cerr << std::endl;
std::cerr << "ERROR: " << exception.what() << std::endl;
return 1;
}
catch (solidity::phaser::InvalidProgram const& exception)
{
// Error in the input data. One of the provided programs contains errors and could not be loaded.