From 53803801f7274b2036e47b2c7f1daabb9f9f9d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 28 Feb 2020 03:47:00 +0100 Subject: [PATCH] [yul-phaser] Move handling of boost::program_options::error to the top-level exception handler --- tools/yulPhaser/Phaser.cpp | 14 +++----------- tools/yulPhaser/main.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/yulPhaser/Phaser.cpp b/tools/yulPhaser/Phaser.cpp index cc093c9c8..87bbb0eba 100644 --- a/tools/yulPhaser/Phaser.cpp +++ b/tools/yulPhaser/Phaser.cpp @@ -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) { diff --git a/tools/yulPhaser/main.cpp b/tools/yulPhaser/main.cpp index 0b56f0165..1cfd310b7 100644 --- a/tools/yulPhaser/main.cpp +++ b/tools/yulPhaser/main.cpp @@ -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.