aboutsummaryrefslogtreecommitdiff
path: root/include/cru
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru')
-rw-r--r--include/cru/base/Exception.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/cru/base/Exception.h b/include/cru/base/Exception.h
index b299acc4..d102c263 100644
--- a/include/cru/base/Exception.h
+++ b/include/cru/base/Exception.h
@@ -10,27 +10,32 @@ namespace cru {
#endif
class CRU_BASE_API Exception : public std::exception {
public:
- explicit Exception(String message = {},
+ explicit Exception(std::string message = "",
+ std::unique_ptr<std::exception> inner = nullptr);
+ explicit Exception(StringView message,
std::unique_ptr<std::exception> inner = nullptr);
~Exception() override;
public:
- String GetMessage() const { return message_; }
+ [[deprecated("Use GetUtf8Message.")]] String GetMessage() const {
+ return String::FromUtf8(message_);
+ }
+
+ std::string GetUtf8Message() const { return this->message_; }
std::exception* GetInner() const noexcept { return inner_.get(); }
const char* what() const noexcept override;
protected:
- void SetMessage(String message) { message_ = std::move(message); }
+ void SetMessage(StringView message) { message_ = message.ToUtf8(); }
void AppendMessage(StringView additional_message);
void AppendMessage(std::optional<StringView> additional_message);
private:
- String message_;
- mutable std::string utf8_message_;
+ std::string message_;
std::unique_ptr<std::exception> inner_;
};