aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore/Exceptions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libdevcore/Exceptions.cpp')
-rw-r--r--libdevcore/Exceptions.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/libdevcore/Exceptions.cpp b/libdevcore/Exceptions.cpp
index 25fd1478..f204dbc2 100644
--- a/libdevcore/Exceptions.cpp
+++ b/libdevcore/Exceptions.cpp
@@ -24,12 +24,14 @@ using namespace dev;
char const* Exception::what() const noexcept
{
+ // Return the comment if available.
if (string const* cmt = comment())
- return cmt->c_str();
- else
- /// Boost accepts nullptr, but the C++ standard doesn't
- /// and crashes on some platforms.
- return std::exception::what();
+ return cmt->data();
+
+ // Fallback to base what().
+ // Boost accepts nullptr, but the C++ standard doesn't
+ // and crashes on some platforms.
+ return std::exception::what();
}
string Exception::lineInfo() const