Skip to content

Commit 68f8bef

Browse files
committed
Fix
1 parent c25d371 commit 68f8bef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/ystdlib/error_handling/Result.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ using Result = BOOST_OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>;
4242
*/
4343
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
4444
#define YSTDLIB_ERROR_HANDLING_TRYV(expr) BOOST_OUTCOME_TRYV(expr)
45+
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
46+
#define YSTDLIB_ERROR_HANDLING_TRY(val, expr) BOOST_OUTCOME_TRY(auto &&(val), (expr))
4547
} // namespace ystdlib::error_handling
4648

4749
#endif // YSTDLIB_ERROR_HANDLING_RESULT_HPP

src/ystdlib/error_handling/test/test_Result.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ TEST_CASE("test_result_int_in_main", "[error_handling][Result]") {
8888

8989
TEST_CASE("test_result_int_propagate", "[error_handling][Result]") {
9090
auto main_func = [&](bool is_error) -> Result<int> {
91-
BOOST_OUTCOME_TRY(auto &&value, cIntFunc(is_error));
91+
YSTDLIB_ERROR_HANDLING_TRY(value, cIntFunc(is_error));
9292
return value;
9393
};
9494
auto const main_no_error{main_func(false)};
@@ -127,7 +127,7 @@ TEST_CASE("test_result_unique_ptr_in_main", "[error_handling][Result]") {
127127

128128
TEST_CASE("test_result_unique_ptr_propagate", "[error_handling][Result]") {
129129
auto main_func = [&](bool is_error) -> Result<std::unique_ptr<int>> {
130-
BOOST_OUTCOME_TRY(auto &&value, cUniquePtrFunc(is_error));
130+
YSTDLIB_ERROR_HANDLING_TRY(value, cUniquePtrFunc(is_error));
131131
return value;
132132
};
133133
auto const main_no_error{main_func(false)};

0 commit comments

Comments
 (0)