24
24
#include < libyul/backends/evm/EVMDialect.h>
25
25
26
26
#include < libsolutil/Assertions.h>
27
+ #include < libsolutil/Exceptions.h>
27
28
#include < libsolutil/StringUtils.h>
28
29
29
30
#include < boost/algorithm/string.hpp>
@@ -185,8 +186,7 @@ bool CommonOptions::parse(int argc, char const* const* argv)
185
186
{
186
187
// Request as uint64_t, since uint8_t will be parsed as character by boost.
187
188
uint64_t eofVersion = arguments[" eof-version" ].as <uint64_t >();
188
- if (eofVersion != 1 )
189
- BOOST_THROW_EXCEPTION (std::runtime_error (" Invalid EOF version: " + std::to_string (eofVersion)));
189
+ solRequire (eofVersion == 1 , ConfigException, " Invalid EOF version: " + std::to_string (eofVersion));
190
190
m_eofVersion = 1 ;
191
191
}
192
192
@@ -198,11 +198,7 @@ bool CommonOptions::parse(int argc, char const* const* argv)
198
198
(parsedOption.original_tokens .size () == 1 && parsedOption.original_tokens .front ().empty ())
199
199
)
200
200
continue ; // ignore empty options
201
- std::stringstream errorMessage;
202
- errorMessage << " Unrecognized option: " ;
203
- for (auto const & token: parsedOption.original_tokens )
204
- errorMessage << token;
205
- BOOST_THROW_EXCEPTION (std::runtime_error (errorMessage.str ()));
201
+ solThrow (ConfigException, " Unrecognized option: " + util::joinHumanReadable (parsedOption.original_tokens , " " ));
206
202
}
207
203
}
208
204
catch (po::error const & exception)
@@ -262,8 +258,7 @@ langutil::EVMVersion CommonOptions::evmVersion() const
262
258
if (!m_evmVersionString.empty ())
263
259
{
264
260
auto version = langutil::EVMVersion::fromString (m_evmVersionString);
265
- if (!version)
266
- BOOST_THROW_EXCEPTION (std::runtime_error (" Invalid EVM version: " + m_evmVersionString));
261
+ solRequire (version, ConfigException, " Invalid EVM version: " + m_evmVersionString);
267
262
return *version;
268
263
}
269
264
else
@@ -279,7 +274,7 @@ yul::EVMDialect const& CommonOptions::evmDialect() const
279
274
CommonOptions const & CommonOptions::get ()
280
275
{
281
276
if (!m_singleton)
282
- BOOST_THROW_EXCEPTION ( std::runtime_error ( " Options not yet constructed!" ) );
277
+ soltestAssert ( false , " Options not yet constructed!" );
283
278
284
279
return *m_singleton;
285
280
}
0 commit comments