diff options
author | Sven Gothel <[email protected]> | 2020-10-13 15:59:41 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-13 15:59:41 +0200 |
commit | 3f2a1359b1f7b44a3085c5a7fd72e0577932b251 (patch) | |
tree | f4b17765966b896519b4123d5d0c0f8d34d662aa /src | |
parent | 35e409a6b0d6a3a77951482e6bb2c4176d0468e1 (diff) |
direct_bt::RuntimeException: backtrace must be fetched at ctor (duh!), expose std::string backtrace via get_backtrace()
Diffstat (limited to 'src')
-rw-r--r-- | src/direct_bt/BasicTypes.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/direct_bt/BasicTypes.cpp b/src/direct_bt/BasicTypes.cpp index cfd9b29e..ce3519e5 100644 --- a/src/direct_bt/BasicTypes.cpp +++ b/src/direct_bt/BasicTypes.cpp @@ -50,11 +50,17 @@ int64_t direct_bt::getCurrentMilliseconds() noexcept { return t.tv_sec * MilliPerOne + t.tv_nsec / NanoPerMilli; } +direct_bt::RuntimeException::RuntimeException(std::string const type, std::string const m, const char* file, int line) noexcept +: msg(std::string(type).append(" @ ").append(file).append(":").append(std::to_string(line)).append(": ").append(m)), + backtrace(direct_bt::get_backtrace(1)) +{ +} + const char* direct_bt::RuntimeException::what() const noexcept { // return std::runtime_error::what(); std::string out(msg); - out.append("\nBacktrace:\n"); - out.append(get_backtrace(1)); + out.append("\nNative backtrace:\n"); + out.append(backtrace); return out.c_str(); } |