aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2017-10-02 22:49:45 +0800
committerGitHub <noreply@github.com>2017-10-02 22:49:45 +0800
commit931c0bcce35b05cbe54c0eacb23669e76e1b4a7b (patch)
tree191230af9d2c7fdbeb19e9ed22527f940bcf3cc4 /libdevcore
parente7cea2f684cd754be0092093d97821604c6e65a2 (diff)
downloaddexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar.gz
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar.bz2
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar.lz
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar.xz
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.tar.zst
dexon-solidity-931c0bcce35b05cbe54c0eacb23669e76e1b4a7b.zip
Refactor Exception::what()
Diffstat (limited to 'libdevcore')
-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