diff options
author | babenko <babenko@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
commit | f31097c96270919a1f49360bdaaa69ea4f3fefab (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yt/exception | |
parent | cec37806d8847aa3db53bafc9e251d4aaf325c12 (diff) | |
download | ydb-f31097c96270919a1f49360bdaaa69ea4f3fefab.tar.gz |
Restoring authorship annotation for <babenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/exception')
-rw-r--r-- | library/cpp/yt/exception/exception.cpp | 96 | ||||
-rw-r--r-- | library/cpp/yt/exception/exception.h | 90 | ||||
-rw-r--r-- | library/cpp/yt/exception/ya.make | 14 |
3 files changed, 100 insertions, 100 deletions
diff --git a/library/cpp/yt/exception/exception.cpp b/library/cpp/yt/exception/exception.cpp index fee90ec2dd..1059d497e8 100644 --- a/library/cpp/yt/exception/exception.cpp +++ b/library/cpp/yt/exception/exception.cpp @@ -1,48 +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 +#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 diff --git a/library/cpp/yt/exception/exception.h b/library/cpp/yt/exception/exception.h index 9697c1d51f..7d35637d60 100644 --- a/library/cpp/yt/exception/exception.h +++ b/library/cpp/yt/exception/exception.h @@ -1,45 +1,45 @@ -#pragma once - -#include <util/generic/string.h> - -#include <exception> - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// -// These are poor man's versions of NYT::TErrorException to be used in -// a limited subset of core libraries that are needed to implement NYT::TError. - -class TSimpleException - : public std::exception -{ -public: - explicit TSimpleException(TString message); - - const TString& GetMesage() const; - const char* what() const noexcept override; - -protected: - const TString Message_; -}; - -class TCompositeException - : public TSimpleException -{ -public: - explicit TCompositeException(TString message); - TCompositeException( - const std::exception& exception, - TString message); - - const std::exception_ptr& GetInnerException() const; - const char* what() const noexcept override; - -private: - const std::exception_ptr InnerException_; - const TString What_; -}; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT +#pragma once + +#include <util/generic/string.h> + +#include <exception> + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// +// These are poor man's versions of NYT::TErrorException to be used in +// a limited subset of core libraries that are needed to implement NYT::TError. + +class TSimpleException + : public std::exception +{ +public: + explicit TSimpleException(TString message); + + const TString& GetMesage() const; + const char* what() const noexcept override; + +protected: + const TString Message_; +}; + +class TCompositeException + : public TSimpleException +{ +public: + explicit TCompositeException(TString message); + TCompositeException( + const std::exception& exception, + TString message); + + const std::exception_ptr& GetInnerException() const; + const char* what() const noexcept override; + +private: + const std::exception_ptr InnerException_; + const TString What_; +}; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/library/cpp/yt/exception/ya.make b/library/cpp/yt/exception/ya.make index a93b31edd9..0c89c31dc3 100644 --- a/library/cpp/yt/exception/ya.make +++ b/library/cpp/yt/exception/ya.make @@ -1,7 +1,7 @@ -LIBRARY() - -SRCS( - exception.cpp -) - -END() +LIBRARY() + +SRCS( + exception.cpp +) + +END() |