MCPcopy Create free account
hub / github.com/boostorg/leaf / main

Function main

test/diagnostics_test2.cpp:32–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30};
31
32int main()
33{
34 leaf::try_handle_all(
35 []() -> leaf::result<void>
36 {
37 return leaf::try_handle_some(
38 []() -> leaf::result<void>
39 {
40 leaf::try_handle_all(
41 []() -> leaf::result<void>
42 {
43 return leaf::new_error(info<1>{});
44 },
45 []
46 {
47 } );
48 return leaf::new_error(info<2>{});
49 },
50 []( info<1> )
51 {
52 } );
53 },
54 []( leaf::diagnostic_details const & di )
55 {
56#if BOOST_LEAF_CFG_STD_STRING
57 std::ostringstream st;
58 st << di;
59 std::string s = st.str();
60 std::cout << s << std::endl;
61 if( BOOST_LEAF_CFG_DIAGNOSTICS && BOOST_LEAF_CFG_CAPTURE )
62 BOOST_TEST_NE(s.find("info<2>"), s.npos);
63#endif
64 } );
65
66#ifndef BOOST_LEAF_NO_EXCEPTIONS
67
68 std::cout << __LINE__ << " ----\n";
69
70 leaf::try_catch(
71 []
72 {
73 leaf::try_catch(
74 []
75 {
76 leaf::try_catch(
77 []
78 {
79 leaf::throw_exception(info<1>{});
80 },
81 []
82 {
83 } );
84 leaf::throw_exception(info<2>{});
85 },
86 []( info<1> )
87 {
88 } );
89 },

Callers

nothing calls this directly

Calls 8

try_handle_allFunction · 0.85
try_handle_someFunction · 0.85
new_errorFunction · 0.85
try_catchFunction · 0.85
on_errorFunction · 0.85
report_errorsFunction · 0.85
throw_exceptionFunction · 0.70
exceptionClass · 0.50

Tested by

no test coverage detected