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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// error.rs
//! # Error Handling Module
//!
//! This module provides custom error handling for the StackQL Deploy application.
//! It defines a comprehensive `AppError` enum that encapsulates various error conditions
//! the application may encounter. Implementations of standard traits like `Display` and `Error`
//! are provided to allow seamless integration with Rust's error handling ecosystem.
//!
//! # Usage Example
//! ```rust
//! use crate::error::AppError;
//!
//! fn example_function() -> Result<(), AppError> {
//! Err(AppError::BinaryNotFound)
//! }
//! ```
use Error;
use fmt;
use PathBuf;
// ============================
// Application Error Definitions
// ============================
/// Represents errors that may occur within the application.
///
/// This enum provides a common error type that encapsulates various issues such as:
/// - Missing binary files
/// - Failed command execution
/// - I/O errors
// ============================
// Display Trait Implementation
// ============================
// ============================
// Error Trait Implementation
// ============================
// ============================
// Conversion From std::io::Error
// ============================
// ============================
// Utility Functions
// ============================
/// Attempts to retrieve the binary path, returning an `AppError` if not found.
///
/// This function calls `get_binary_path()` from the `utils::binary` module and converts
/// an `Option<PathBuf>` to a `Result<PathBuf, AppError>`.
///
/// # Errors
/// - Returns `AppError::BinaryNotFound` if the binary path cannot be located.
///
/// # Example
/// ```rust
/// use crate::error::{get_binary_path_with_error, AppError};
///
/// match get_binary_path_with_error() {
/// Ok(path) => println!("Binary found at: {:?}", path),
/// Err(e) => eprintln!("Error: {}", e),
/// }
/// ```