From 7a24a5764edf728f0caa14e7aa8f832d7e6f42e3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 24 Feb 2017 19:31:20 +0100 Subject: Add line info to serious exceptions. --- libsolidity/interface/Exceptions.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libsolidity/interface') diff --git a/libsolidity/interface/Exceptions.cpp b/libsolidity/interface/Exceptions.cpp index 90a680b4..41890b91 100644 --- a/libsolidity/interface/Exceptions.cpp +++ b/libsolidity/interface/Exceptions.cpp @@ -23,6 +23,7 @@ #include #include +using namespace std; using namespace dev; using namespace dev::solidity; @@ -56,3 +57,16 @@ Error::Error(Type _type): m_type(_type) break; } } + +string Exception::lineInfo() const +{ + char const* const* file = boost::get_error_info(*this); + int const* line = boost::get_error_info(*this); + string ret; + if (file) + ret += *file; + ret += ':'; + if (line) + ret += boost::lexical_cast(*line); + return ret; +} -- cgit