]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | # Print File Example |
2 | ||
3 | This directory has several versions of the same simple program presented in the [Five Minute Introduction](https://boostorg.github.io/leaf/#introduction), each using a different error handling style: | |
4 | ||
5 | ## Using exception handling: | |
6 | ||
7 | * [print_file_eh.cpp](./print_file_eh.cpp) throws on error, using an exception type hierarchy for classification of failures. | |
8 | ||
9 | * [print_file_eh_error_tags.cpp](./print_file_eh_error_tags.cpp) throws `std::exception` on error, using a separate set of individual error types, rather than an exception type hierarchy, for classification of failures. | |
10 | ||
11 | ## Using a `result<T>` type: | |
12 | ||
13 | * [print_file_result.cpp](./print_file_result.cpp) reports errors with `leaf::result<T>`, using an error code `enum` for classification of failures. | |
14 | ||
15 | * [print_file_outcome_result.cpp](./print_file_outcome_result.cpp) is the same as the above, but using `outcome::result<T>`. This demonstrates the ability to transport arbitrary error objects through APIs that do not use `leaf::result<T>`. | |
16 | ||
17 | * [print_file_result_error_tags.cpp](./print_file_result_error_tags.cpp) reports errors with `leaf::result<T>`, using a separate set of individual error types, rather than an error code `enum`, for classification of failures. |