mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add line info to serious exceptions.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user