diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yt/exception/exception.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yt/exception/exception.cpp')
-rw-r--r-- | library/cpp/yt/exception/exception.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/library/cpp/yt/exception/exception.cpp b/library/cpp/yt/exception/exception.cpp new file mode 100644 index 0000000000..1059d497e8 --- /dev/null +++ b/library/cpp/yt/exception/exception.cpp @@ -0,0 +1,48 @@ +#include "exception.h" + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +TSimpleException::TSimpleException(TString message) + : Message_(std::move(message)) +{ } + +const TString& TSimpleException::GetMesage() const +{ + return Message_; +} + +const char* TSimpleException::what() const noexcept +{ + return Message_.c_str(); +} + +//////////////////////////////////////////////////////////////////////////////// + +TCompositeException::TCompositeException(TString message) + : TSimpleException(std::move(message)) + , What_(Message_) +{ } + +TCompositeException::TCompositeException( + const std::exception& exception, + TString message) + : TSimpleException(message) + , InnerException_(std::current_exception()) + , What_(message + "\n" + exception.what()) +{ } + +const std::exception_ptr& TCompositeException::GetInnerException() const +{ + return InnerException_; +} + +const char* TCompositeException::what() const noexcept +{ + return What_.c_str(); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT |