CommandLineParser: Report errors by raising exceptions

This commit is contained in:
Kamil Śliwak
2021-11-09 18:16:30 +01:00
parent cda0d029bc
commit 3f5471165f
4 changed files with 210 additions and 287 deletions
+11 -2
View File
@@ -23,6 +23,8 @@
*/
#include <solc/CommandLineInterface.h>
#include <solc/Exceptions.h>
#include "license.h"
#include "solidity/BuildInfo.h"
@@ -592,9 +594,16 @@ bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
return false;
}
bool success = parser.parse(_argc, _argv);
if (!success)
try
{
parser.parse(_argc, _argv);
}
catch (CommandLineValidationError const& _exception)
{
serr() << _exception.what() << endl;
return false;
}
m_hasOutput = m_hasOutput || parser.hasOutput();
m_options = parser.options();