diff options
author | crupest <crupest@outlook.com> | 2022-01-15 22:41:11 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-15 22:41:11 +0800 |
commit | 570e95f4551385a81eb2cf6f2e386e3b0cb291a8 (patch) | |
tree | 8ed08ab29f49b260ac66e88a75aa436c4daefb57 /src/common/Exception.cpp | |
parent | abb9d48a72e2d580d6bfbfcb600795c5ec66e204 (diff) | |
download | cru-570e95f4551385a81eb2cf6f2e386e3b0cb291a8.tar.gz cru-570e95f4551385a81eb2cf6f2e386e3b0cb291a8.tar.bz2 cru-570e95f4551385a81eb2cf6f2e386e3b0cb291a8.zip |
...
Diffstat (limited to 'src/common/Exception.cpp')
-rw-r--r-- | src/common/Exception.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common/Exception.cpp b/src/common/Exception.cpp new file mode 100644 index 00000000..779c65d6 --- /dev/null +++ b/src/common/Exception.cpp @@ -0,0 +1,17 @@ +#include "cru/common/Exception.hpp" + +namespace cru { +Exception::Exception() {} + +Exception::Exception(String message) : message_(std::move(message)) {} + +Exception::~Exception() {} + +const char* Exception::what() const noexcept { + if (!message_.empty() && utf8_message_.empty()) { + utf8_message_ = message_.ToUtf8(); + } + + return utf8_message_.c_str(); +} +} // namespace cru |