diff options
author | crupest <crupest@outlook.com> | 2024-06-01 17:09:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-06-08 17:01:55 +0800 |
commit | d1f409530db6f9b712fd672c4c3154cac7eebad1 (patch) | |
tree | 1e48a3e2ff14e66aac2503a74df28cca7d85d02c /include/cru/common/Exception.h | |
parent | ad796a167e33b54c7fa23ea21c73d57dba4fc928 (diff) | |
download | cru-d1f409530db6f9b712fd672c4c3154cac7eebad1.tar.gz cru-d1f409530db6f9b712fd672c4c3154cac7eebad1.tar.bz2 cru-d1f409530db6f9b712fd672c4c3154cac7eebad1.zip |
HALF WORK: refactor something and implement part of subprocess.
Diffstat (limited to 'include/cru/common/Exception.h')
-rw-r--r-- | include/cru/common/Exception.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/cru/common/Exception.h b/include/cru/common/Exception.h index 0aee871c..609fd2c9 100644 --- a/include/cru/common/Exception.h +++ b/include/cru/common/Exception.h @@ -1,6 +1,7 @@ #pragma once #include "String.h" +#include <exception> #include <optional> namespace cru { @@ -9,16 +10,16 @@ namespace cru { #endif class CRU_BASE_API Exception : public std::exception { public: - explicit Exception(String message = {}); - - CRU_DEFAULT_COPY(Exception) - CRU_DEFAULT_MOVE(Exception) + explicit Exception(String message = {}, + std::unique_ptr<std::exception> inner = nullptr); ~Exception() override; public: String GetMessage() const { return message_; } + std::exception* GetInner() const noexcept { return inner_.get(); } + const char* what() const noexcept override; protected: @@ -30,6 +31,7 @@ class CRU_BASE_API Exception : public std::exception { private: String message_; mutable std::string utf8_message_; + std::unique_ptr<std::exception> inner_; }; class CRU_BASE_API TextEncodeException : public Exception { |