diff --git a/orc-rt/unittests/ErrorTest.cpp b/orc-rt/unittests/ErrorTest.cpp index d9fee99ea817..3da138c1c4ca 100644 --- a/orc-rt/unittests/ErrorTest.cpp +++ b/orc-rt/unittests/ErrorTest.cpp @@ -284,6 +284,21 @@ TEST(ErrorTest, IsAHandling) { consumeError(std::move(G)); } +TEST(Error, ReReturnErrorFromHandler) { + int ErrorInfo = 0; + + Error E = handleErrors(make_error(7), + [&](std::unique_ptr CE) { + return make_error(std::move(CE)); + }); + + handleAllErrors(std::move(E), + [&](const CustomError &CE) { ErrorInfo = CE.getInfo(); }); + + EXPECT_EQ(ErrorInfo, 7) + << "Failed to handle Error returned from handleErrors."; +} + TEST(ErrorTest, StringError) { auto E = make_error("foo"); if (E.isA())