diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-02-17 00:51:41 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-02-17 00:51:41 +0000 |
commit | 53cf150a37baea571bbfa58439c237767ef32350 (patch) | |
tree | 2a5bde3e500da34505f6bfafa5bee5d694c79da9 /library/cpp | |
parent | e03ee598f8925309a8d1aaed2f43f71bb9db5a68 (diff) | |
parent | d7d62149f9bae7bdb622300a54f678cc419c81f9 (diff) | |
download | ydb-53cf150a37baea571bbfa58439c237767ef32350.tar.gz |
Merge branch 'rightlib' into merge-libs-250217-0050
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/yt/error/error-inl.h | 5 | ||||
-rw-r--r-- | library/cpp/yt/error/error.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/error/error.h | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/library/cpp/yt/error/error-inl.h b/library/cpp/yt/error/error-inl.h index c1ba73fbcf0..f82b8eb20d5 100644 --- a/library/cpp/yt/error/error-inl.h +++ b/library/cpp/yt/error/error-inl.h @@ -313,6 +313,11 @@ TErrorOr<T>::TErrorOr(TErrorOr<U>&& other) noexcept } template <class T> +TErrorOr<T>::TErrorOr(const TErrorException& errorEx) noexcept + : TError(errorEx) +{ } + +template <class T> TErrorOr<T>::TErrorOr(const std::exception& ex) : TError(ex) { } diff --git a/library/cpp/yt/error/error.cpp b/library/cpp/yt/error/error.cpp index 866c76eec82..4790fbf6060 100644 --- a/library/cpp/yt/error/error.cpp +++ b/library/cpp/yt/error/error.cpp @@ -242,6 +242,12 @@ TError::TErrorOr(TError&& other) noexcept : Impl_(std::move(other.Impl_)) { } +TError::TErrorOr(const TErrorException& errorEx) noexcept +{ + *this = errorEx.Error(); + // NB: TErrorException verifies that error not IsOK at throwing end. +} + TError::TErrorOr(const std::exception& ex) { if (auto simpleException = dynamic_cast<const TSimpleException*>(&ex)) { diff --git a/library/cpp/yt/error/error.h b/library/cpp/yt/error/error.h index 3def2c4b509..beb097afe2b 100644 --- a/library/cpp/yt/error/error.h +++ b/library/cpp/yt/error/error.h @@ -56,6 +56,9 @@ void FormatValue(TStringBuilderBase* builder, TErrorCode code, TStringBuf spec); //////////////////////////////////////////////////////////////////////////////// +// Forward declaration. +class TErrorException; + template <class TValue> concept CErrorNestable = requires (TError& error, TValue&& operand) { @@ -72,6 +75,8 @@ public: TErrorOr(const TError& other); TErrorOr(TError&& other) noexcept; + TErrorOr(const TErrorException& errorEx) noexcept; + TErrorOr(const std::exception& ex); struct TDisableFormat @@ -365,6 +370,8 @@ public: TErrorOr(const TError& other); TErrorOr(TError&& other) noexcept; + TErrorOr(const TErrorException& errorEx) noexcept; + TErrorOr(const std::exception& ex); template <class U> |