Skip to content

Commit 3f54711

Browse files
committed
CommandLineParser: Report errors by raising exceptions
1 parent cda0d02 commit 3f54711

File tree

4 files changed

+211
-288
lines changed

4 files changed

+211
-288
lines changed

solc/CommandLineInterface.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*/
2424
#include <solc/CommandLineInterface.h>
2525

26+
#include <solc/Exceptions.h>
27+
2628
#include "license.h"
2729
#include "solidity/BuildInfo.h"
2830

@@ -592,9 +594,16 @@ bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
592594
return false;
593595
}
594596

595-
bool success = parser.parse(_argc, _argv);
596-
if (!success)
597+
try
598+
{
599+
parser.parse(_argc, _argv);
600+
}
601+
catch (CommandLineValidationError const& _exception)
602+
{
603+
serr() << _exception.what() << endl;
597604
return false;
605+
}
606+
598607
m_hasOutput = m_hasOutput || parser.hasOutput();
599608
m_options = parser.options();
600609

0 commit comments

Comments
 (0)