ds_common_aws_rs_lib/error.rs
1//! Error module.
2//!
3//! ## Overview
4//! This module contains the unified error types for the DS Common AWS Rust Library.
5//! All functions return `Result<T, Error>` for consistent error handling.
6//!
7//! ## Error Hierarchy
8//!
9//! - [`Error`]: Top-level error enum that unifies all module errors
10//! - [`SsmError`]: Errors from SSM operations
11//! - [`SqsError`]: Errors from SQS operations
12//!
13
14use thiserror::Error;
15
16#[cfg(feature = "sqs")]
17use crate::sqs::error::SqsError;
18#[cfg(feature = "ssm")]
19use crate::ssm::error::SsmError;
20
21/// Unified result type for all operations.
22///
23/// This is equivalent to `Result<T, Error>` and provides consistent
24/// error handling across all modules.
25pub type Result<T, E = Error> = std::result::Result<T, E>;
26
27// region: --> Error
28
29/// Top-level error enum that unifies all module errors.
30///
31/// This enum provides a single error type for all operations,
32/// making error handling consistent and ergonomic for users.
33#[derive(Error, Debug)]
34pub enum Error {
35 /// Errors from SSM operations
36 #[cfg(feature = "ssm")]
37 #[error(transparent)]
38 Ssm(#[from] SsmError),
39
40 /// Errors from SQS operations
41 #[cfg(feature = "sqs")]
42 #[error(transparent)]
43 Sqs(#[from] SqsError),
44}
45
46// endregion: --> Error