From 02521a164ce8fc49d6d4af584da127098c59ba2f Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 19 Jan 2015 18:58:09 +0100 Subject: [PATCH] Improved handling of exceptions in some Solidity Tests --- SolidityABIJSON.cpp | 8 ++------ SolidityNatspecJSON.cpp | 8 ++------ solidityExecutionFramework.h | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/SolidityABIJSON.cpp b/SolidityABIJSON.cpp index d553f576a..892b71f15 100644 --- a/SolidityABIJSON.cpp +++ b/SolidityABIJSON.cpp @@ -41,13 +41,9 @@ public: { m_compilerStack.parse(_code); } - catch (const std::exception& e) + catch(boost::exception const& _e) { - std::string const* extra = boost::get_error_info(e); - std::string msg = std::string("Parsing contract failed with: ") + - e.what() + std::string("\n"); - if (extra) - msg += *extra; + auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e); BOOST_FAIL(msg); } std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABI_INTERFACE); diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp index d43aebc2b..5cec0444c 100644 --- a/SolidityNatspecJSON.cpp +++ b/SolidityNatspecJSON.cpp @@ -45,13 +45,9 @@ public: { m_compilerStack.parse(_code); } - catch (const std::exception& e) + catch(boost::exception const& _e) { - std::string const* extra = boost::get_error_info(e); - std::string msg = std::string("Parsing contract failed with: ") + - e.what() + std::string("\n"); - if (extra) - msg += *extra; + auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e); BOOST_FAIL(msg); } diff --git a/solidityExecutionFramework.h b/solidityExecutionFramework.h index 1aea61fec..271a594c4 100644 --- a/solidityExecutionFramework.h +++ b/solidityExecutionFramework.h @@ -50,13 +50,9 @@ public: { compiler.compile(_sourceCode, m_optimize); } - catch (const std::exception& e) + catch(boost::exception const& _e) { - std::string const* extra = boost::get_error_info(e); - std::string msg = std::string("Parsing contract failed with: ") + - e.what() + std::string("\n"); - if (extra) - msg += *extra; + auto msg = std::string("Compiling contract failed with: ") + boost::diagnostic_information(_e); BOOST_FAIL(msg); }