use thiserror::Error;
#[derive(Debug, Error)]
pub enum ServerlessError {
#[error("Cold start timeout: {0}ms exceeded")]
ColdStartTimeout(u64),
#[error("Fragment pool error: {0}")]
PoolError(String),
#[error("Snapshot error: {0}")]
SnapshotError(String),
#[error("State serialization error: {0}")]
SerializationError(String),
#[error("State deserialization error: {0}")]
DeserializationError(String),
#[error("Provider error: {0}")]
ProviderError(String),
#[error("Memory limit exceeded: {used_mb}MB / {limit_mb}MB")]
MemoryLimitExceeded { used_mb: u64, limit_mb: u64 },
#[error("GPU not available in this environment")]
GpuNotAvailable,
#[error("Warmup failed: {0}")]
WarmupFailed(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("Configuration error: {0}")]
ConfigError(String),
}
pub type Result<T> = std::result::Result<T, ServerlessError>;