mirror of
https://github.com/haraldh/chainerror.git
synced 2025-04-11 03:24:51 +02:00
doc: add usage example for error handling in main function
This commit adds a usage example demonstrating how to handle errors returned by the `func1` function in the main function. The example provides clarity on practical error handling and makes the documentation more comprehensive for users.
This commit is contained in:
parent
354f7b92ed
commit
5390007cbe
|
@ -689,6 +689,12 @@ macro_rules! str_context {
|
|||
/// do_some_io(filename).map_context(|e| ErrorKind::from(e))?;
|
||||
/// Ok(())
|
||||
/// }
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # if let Err(e) = func1() {
|
||||
/// # eprintln!("Error:\n{:?}", e);
|
||||
/// # }
|
||||
/// # }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! err_kind {
|
||||
|
|
Loading…
Reference in a new issue