aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-02-25 02:31:20 +0800
committerchriseth <c@ethdev.com>2017-02-25 02:32:41 +0800
commit7a24a5764edf728f0caa14e7aa8f832d7e6f42e3 (patch)
tree3401978cddc171067362ab904364204b90c9e3d0 /libsolidity
parentd2c79bf8e9400f783bf0feed34065882eae02a68 (diff)
downloaddexon-solidity-7a24a5764edf728f0caa14e7aa8f832d7e6f42e3.tar.gz
dexon-solidity-7a24a5764edf728f0caa14e7aa8f832d7e6f42e3.tar.zst
dexon-solidity-7a24a5764edf728f0caa14e7aa8f832d7e6f42e3.zip
Add line info to serious exceptions.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/Exceptions.cpp14
1 files changed, 14 insertions, 0 deletions
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 <libsolidity/interface/Exceptions.h>
#include <libsolidity/interface/Utils.h>
+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<boost::throw_file>(*this);
+ int const* line = boost::get_error_info<boost::throw_line>(*this);
+ string ret;
+ if (file)
+ ret += *file;
+ ret += ':';
+ if (line)
+ ret += boost::lexical_cast<string>(*line);
+ return ret;
+}