diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-04-02 00:51:46 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-04-02 00:51:46 +0000 |
commit | f6416f5c4da60c922a0e1f07ec342fda00837d54 (patch) | |
tree | fd9b88400f5fc74b30a0ffacba8d6c0905b2fc6a /library/cpp/yt/error/unittests/error_ut.cpp | |
parent | d30ab64d66bbeced779befb5033f1d81462dde2a (diff) | |
parent | 82a20ed13f9ce647673791b772685ee5997f256d (diff) | |
download | ydb-f6416f5c4da60c922a0e1f07ec342fda00837d54.tar.gz |
Merge branch 'rightlib' into merge-libs-250402-0050
Diffstat (limited to 'library/cpp/yt/error/unittests/error_ut.cpp')
-rw-r--r-- | library/cpp/yt/error/unittests/error_ut.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/library/cpp/yt/error/unittests/error_ut.cpp b/library/cpp/yt/error/unittests/error_ut.cpp index 198aa1ecd8..a5576fad58 100644 --- a/library/cpp/yt/error/unittests/error_ut.cpp +++ b/library/cpp/yt/error/unittests/error_ut.cpp @@ -397,6 +397,22 @@ TEST(TErrorTest, FormatCtor) EXPECT_EQ("Some error hello", TError("Some error %v", "hello").GetMessage()); } +TEST(TErrorTest, ExceptionCtor) +{ + { + auto error = TError(std::runtime_error("Some error")); + EXPECT_EQ(error.GetMessage(), "Some error"); + EXPECT_EQ(error.Attributes().Get<std::string>("exception_type"), "std::runtime_error"); + } + EXPECT_EQ(TError(std::runtime_error("Some bad char sequences: %v %Qv {}")).GetMessage(), + "Some bad char sequences: %v %Qv {}"); + + EXPECT_EQ(TError(TSimpleException("Some error")).GetMessage(), + "Some error"); + EXPECT_EQ(TError(TSimpleException("Some bad char sequences: %v %d {}")).GetMessage(), + "Some bad char sequences: %v %d {}"); +} + TEST(TErrorTest, FindRecursive) { auto inner = TError("Inner") |