aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-04 17:30:07 +0800
committerGitHub <noreply@github.com>2017-10-04 17:30:07 +0800
commit0c3888aba263fe89110c6197fe3e74e4c8176624 (patch)
tree4a0428eb500657cffd2e61ced755198d5ab79c16
parentd41011a0f674b253f274238a1c25073ed5139c35 (diff)
parent931c0bcce35b05cbe54c0eacb23669e76e1b4a7b (diff)
downloaddexon-solidity-0c3888aba263fe89110c6197fe3e74e4c8176624.tar.gz
dexon-solidity-0c3888aba263fe89110c6197fe3e74e4c8176624.tar.zst
dexon-solidity-0c3888aba263fe89110c6197fe3e74e4c8176624.zip
Merge pull request #3009 from ethereum/refactor-exception-what
Refactor Exception::what()
-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