Files
mytheclipse/crates/corex-config/src/error.rs
T
asepharyana d119821339 feat: add panic tracking and logging with PanicTracker
- Implemented PanicTracker to log panics using tracing within a dedicated span.
- Introduced PanicInfo struct to capture panic details.
- Added tests for panic catching and hook restoration.

feat: implement token-bucket rate limiter

- Created RateLimiter to manage token consumption with configurable rates and burst capacity.
- Added methods for acquiring tokens and checking available tokens.
- Included tests for rate limiting behavior and token availability.

feat: add automatic retry with exponential backoff

- Developed retry function to handle transient errors with configurable retry strategies.
- Introduced RetryConfig for customizing retry behavior and jitter.
- Added tests for various retry scenarios and error handling.

feat: implement graceful shutdown coordination

- Created ShutdownManager to manage shutdown signals and task completion.
- Introduced ShutdownSignal for tasks to observe shutdown requests.
- Added tests for shutdown request handling and task draining.

feat: add timeout functionality for async operations

- Implemented with_timeout function to enforce execution time limits on futures.
- Created Timeout struct for wrapping futures with a deadline.
- Added tests for timeout behavior and error mapping.
2026-08-28 21:46:18 +07:00

33 lines
1.2 KiB
Rust

//! Shared error type for corex-config.
/// Errors surfaced while loading or reloading configuration.
#[non_exhaustive]
#[derive(Debug)]
pub enum ConfigError {
/// An I/O error reading a config source (file not found, permissions, ...).
Io(String),
/// A source could not be parsed (malformed YAML/JSON/TOML).
Parse(String),
/// The merged configuration could not be deserialized into the target type.
Deserialize(String),
/// The requested file extension has no registered loader (feature not
/// enabled, or unsupported format).
UnsupportedFormat(String),
/// Hot-reload setup failed (e.g. the file watcher could not be installed).
Watch(String),
}
impl std::fmt::Display for ConfigError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Io(s) => write!(f, "config io error: {s}"),
Self::Parse(s) => write!(f, "config parse error: {s}"),
Self::Deserialize(s) => write!(f, "config deserialize error: {s}"),
Self::UnsupportedFormat(s) => write!(f, "unsupported config format: {s}"),
Self::Watch(s) => write!(f, "config watch error: {s}"),
}
}
}
impl std::error::Error for ConfigError {}