Browse Source

Improved handling of exceptions in some Solidity Tests

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
c3c2b1cf76
  1. 8
      test/SolidityABIJSON.cpp
  2. 8
      test/SolidityNatspecJSON.cpp
  3. 8
      test/solidityExecutionFramework.h

8
test/SolidityABIJSON.cpp

@ -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);

8
test/SolidityNatspecJSON.cpp

@ -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);
} }

8
test/solidityExecutionFramework.h

@ -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);
} }

Loading…
Cancel
Save