1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Error types for the learnerd CLI application.
//!
//! This module provides a comprehensive error type that encompasses all possible
//! failure modes when running the CLI, including:
//! - User interaction errors
//! - Database and paper management errors
//! - File system operations
//! - Pattern matching errors
//!
//! The errors are designed to be transparent, allowing the underlying error
//! details to be displayed to the user while maintaining proper error
//! handling and propagation.
use Error;
/// Error type alias used for the [`learnerd`] crate.
pub type Result<T> = Result;
/// Errors that can occur during CLI operations.
///
/// This enum wraps various error types from dependencies and the underlying
/// library into a single error type for the CLI application. It uses the
/// `transparent` error handling pattern to preserve the original error
/// messages and context.
///
/// # Examples
///
/// ```
/// use std::path::PathBuf;
///
/// use learnerd::LearnerdErrors;
///
/// # fn example() -> Result<(), LearnerdErrors> {
/// // File operations may result in IO errors
/// std::fs::create_dir_all(PathBuf::from("some/path"))?;
///
/// // User interactions may result in Dialoguer errors
/// let input = dialoguer::Input::<String>::new().with_prompt("Enter something").interact()?;
///
/// # Ok(())
/// # }
/// ```