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//! - [`SsmError`]: Errors from SSM operations
10//! - [`SqsError`]: Errors from SQS operations
11//! - [`S3Error`]: Errors from S3 operations
12//!
13
14use thiserror::Error;
15
16#[cfg(feature = "s3")]
17use crate::s3::error::S3Error;
18#[cfg(feature = "sqs")]
19use crate::sqs::error::SqsError;
20#[cfg(feature = "ssm")]
21use crate::ssm::error::SsmError;
22
23/// Unified result type for all operations.
24///
25/// This is equivalent to `Result<T, Error>` and provides consistent
26/// error handling across all modules.
27pub type Result<T, E = Error> = std::result::Result<T, E>;
28
29// region: --> Error
30
31/// Top-level error enum that unifies all module errors.
32///
33/// This enum provides a single error type for all operations,
34/// making error handling consistent and ergonomic for users.
35#[derive(Error, Debug)]
36pub enum Error {
37    /// Errors from SSM operations
38    #[cfg(feature = "ssm")]
39    #[error(transparent)]
40    Ssm(#[from] SsmError),
41
42    /// Errors from SQS operations
43    #[cfg(feature = "sqs")]
44    #[error(transparent)]
45    Sqs(#[from] SqsError),
46
47    /// Errors from S3 operations
48    #[cfg(feature = "s3")]
49    #[error(transparent)]
50    S3(#[from] S3Error),
51}
52
53// endregion: --> Error