| 63 | } |
| 64 | |
| 65 | int main( int argc, char const * argv[] ) |
| 66 | { |
| 67 | return leaf::try_handle_all( |
| 68 | [&]() -> leaf::result<int> |
| 69 | { |
| 70 | BOOST_LEAF_CHECK( print_half(argc<2 ? "" : argv[1]) ); |
| 71 | std::cout << "ok" << std::endl; |
| 72 | return 0; |
| 73 | }, |
| 74 | |
| 75 | []( leaf::match<ConversionErrc, ConversionErrc::EmptyString> ) |
| 76 | { |
| 77 | std::cerr << "Empty string!" << std::endl; |
| 78 | return 1; |
| 79 | }, |
| 80 | |
| 81 | []( leaf::match<ConversionErrc, ConversionErrc::IllegalChar> ) |
| 82 | { |
| 83 | std::cerr << "Illegal char!" << std::endl; |
| 84 | return 2; |
| 85 | }, |
| 86 | |
| 87 | []( leaf::error_info const & unmatched ) |
| 88 | { |
| 89 | // This will never execute in this program, but it would detect |
| 90 | // logic errors where an unknown error reaches main. In this case, |
| 91 | // we print diagnostic information. |
| 92 | std::cerr << |
| 93 | "Unknown failure detected" << std::endl << |
| 94 | "Cryptic diagnostic information follows" << std::endl << |
| 95 | unmatched; |
| 96 | return 3; |
| 97 | } ); |
| 98 | } |
| 99 | |
| 100 | //////////////////////////////////////// |
| 101 |
nothing calls this directly
no test coverage detected