Call compute_answer_throws, switch to result for error handling.
| 32 | |
| 33 | // Call compute_answer_throws, switch to result<int> for error handling. |
| 34 | leaf::result<int> compute_answer() noexcept |
| 35 | { |
| 36 | // Convert exceptions of types error_a and error_b to be communicated by |
| 37 | // leaf::result. Any other exception will be communicated as a |
| 38 | // std::exception_ptr. |
| 39 | return leaf::exception_to_result<error_a, error_b>( |
| 40 | [] |
| 41 | { |
| 42 | return compute_answer_throws(); |
| 43 | } ); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | // Print the answer if the call to compute_answer is successful. |
no test coverage detected