use appcore_types::RuntimeError;
#[derive(Debug, thiserror::Error)]
pub enum GatewayError {
#[error("configuration error: {0}")]
Config(String),
#[error("authentication failed: {0}")]
Authentication(String),
#[error("authorization failed: {0}")]
Forbidden(String),
#[error("tenant mismatch: {0}")]
TenantMismatch(String),
#[error("worker unavailable for capability: {0}")]
WorkerUnavailable(String),
#[error("transport error: {0}")]
Transport(String),
#[error("serialization error: {0}")]
Serialization(String),
#[error("protocol violation: {0}")]
Protocol(String),
#[error("runtime core error: {0:?}")]
Runtime(RuntimeError),
}
impl From<RuntimeError> for GatewayError {
fn from(err: RuntimeError) -> Self {
GatewayError::Runtime(err)
}
}
pub type GatewayResult<T> = Result<T, GatewayError>;