2
0
mirror of https://github.com/boostorg/leaf.git synced 2026-01-19 16:32:08 +00:00
Files
leaf/example

Example Programs Using LEAF to Handle Errors

  • print_file: The complete example from the Five Minute Introduction. This directory contains several versions of the same program, each using a different error handling style.

  • dynamic_capture_result.cpp: Shows how to transport error objects between threads in a leaf::result<T> object without using exception handling.

  • dynamic_capture_eh.cpp: Shows how to transport error objects between threads in an a leaf::result<T> object using exception handling.

  • lua_callback_result.cpp: Transporting arbitrary error objects through an uncooperative C API.

  • lua_callback_eh.cpp: Transporting arbitrary error objects through an uncooperative exception-safe API.

  • exception_to_result.cpp: Demonstrates how to transport exceptions through a noexcept layer in the program.

  • exception_error_log.cpp: Using accumulate to produce an error log.

  • exception_error_trace.cpp: Same as above, but the log is recorded in a std::deque rather than just printed.

  • print_half.cpp: This is a Boost Outcome example adapted to LEAF, demonstrating the use of try_handle_some to handle some errors, forwarding any other error to the caller.

  • asio_beast_leaf_rpc.cpp: A simple RPC calculator implemented with Beast+ASIO+LEAF.