diff options
author | Konstantin Khlebnikov <khlebnikov@tracto.ai> | 2025-02-16 12:50:19 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2025-02-16 13:13:15 +0300 |
commit | 7a3958c3c6de324baab9dba4bd4eb808c1b839a6 (patch) | |
tree | 4b0532c216b5ab8928fb75a329c602b6d088ad37 /library/cpp/yt/error/error.cpp | |
parent | 802da2736bf00631aa408e495b80d6e125f10a9f (diff) | |
download | ydb-7a3958c3c6de324baab9dba4bd4eb808c1b839a6.tar.gz |
yt/error: optimize constructing TError from TErrorException
Here we can avoid dynamic cast and exception hazard.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@tracto.ai>
---
Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1070
commit_hash:e0709e1fe0f2109792b20b850e0e11a6e96f846a
Diffstat (limited to 'library/cpp/yt/error/error.cpp')
-rw-r--r-- | library/cpp/yt/error/error.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/cpp/yt/error/error.cpp b/library/cpp/yt/error/error.cpp index 866c76eec8..4790fbf606 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)) { |