Improved handling of exceptions in some Solidity Tests

This commit is contained in:
Lefteris Karapetsas 2015-01-19 18:58:09 +01:00
parent ab4178941b
commit 02521a164c
3 changed files with 6 additions and 18 deletions

View File

@ -41,13 +41,9 @@ public:
{ {
m_compilerStack.parse(_code); m_compilerStack.parse(_code);
} }
catch (const std::exception& e) catch(boost::exception const& _e)
{ {
std::string const* extra = boost::get_error_info<errinfo_comment>(e); auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e);
std::string msg = std::string("Parsing contract failed with: ") +
e.what() + std::string("\n");
if (extra)
msg += *extra;
BOOST_FAIL(msg); BOOST_FAIL(msg);
} }
std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABI_INTERFACE); std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABI_INTERFACE);

View File

@ -45,13 +45,9 @@ public:
{ {
m_compilerStack.parse(_code); m_compilerStack.parse(_code);
} }
catch (const std::exception& e) catch(boost::exception const& _e)
{ {
std::string const* extra = boost::get_error_info<errinfo_comment>(e); auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e);
std::string msg = std::string("Parsing contract failed with: ") +
e.what() + std::string("\n");
if (extra)
msg += *extra;
BOOST_FAIL(msg); BOOST_FAIL(msg);
} }

View File

@ -50,13 +50,9 @@ public:
{ {
compiler.compile(_sourceCode, m_optimize); compiler.compile(_sourceCode, m_optimize);
} }
catch (const std::exception& e) catch(boost::exception const& _e)
{ {
std::string const* extra = boost::get_error_info<errinfo_comment>(e); auto msg = std::string("Compiling contract failed with: ") + boost::diagnostic_information(_e);
std::string msg = std::string("Parsing contract failed with: ") +
e.what() + std::string("\n");
if (extra)
msg += *extra;
BOOST_FAIL(msg); BOOST_FAIL(msg);
} }