2026-07-27 04:59:33 +08:00
|
|
|
//! Runtime error taxonomy exposed to management layers.
|
|
|
|
|
|
2026-07-30 07:18:21 +08:00
|
|
|
use std::{path::PathBuf, time::Duration};
|
2026-07-27 04:59:33 +08:00
|
|
|
|
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
use crate::manifest::ServiceKey;
|
|
|
|
|
|
|
|
|
|
/// Failures from Runtime configuration, sandbox validation, or Actor execution.
|
|
|
|
|
#[derive(Debug, Error)]
|
|
|
|
|
pub enum RuntimeError {
|
|
|
|
|
#[error("service id and revision must not be empty")]
|
|
|
|
|
InvalidServiceKey,
|
|
|
|
|
|
|
|
|
|
#[error("invalid manifest: {0}")]
|
|
|
|
|
InvalidManifest(String),
|
|
|
|
|
|
|
|
|
|
#[error("manifest parse failed: {0}")]
|
|
|
|
|
ManifestParse(#[from] toml::de::Error),
|
|
|
|
|
|
|
|
|
|
#[error("service revision {0} is not registered")]
|
|
|
|
|
ServiceNotRegistered(ServiceKey),
|
|
|
|
|
|
|
|
|
|
#[error("service revision {0} is already registered")]
|
|
|
|
|
ServiceAlreadyRegistered(ServiceKey),
|
|
|
|
|
|
|
|
|
|
#[error("component compilation failed: {0}")]
|
|
|
|
|
ComponentCompilation(#[source] wasmtime::Error),
|
|
|
|
|
|
|
|
|
|
#[error("component imports unsupported capability {0}")]
|
|
|
|
|
UnsupportedImport(String),
|
|
|
|
|
|
2026-07-29 19:37:10 +08:00
|
|
|
#[error("component requires unavailable capability {0}")]
|
|
|
|
|
CapabilityUnavailable(String),
|
|
|
|
|
|
2026-07-27 04:59:33 +08:00
|
|
|
#[error("runtime creation failed: {0}")]
|
|
|
|
|
RuntimeCreation(#[source] wasmtime::Error),
|
|
|
|
|
|
2026-07-30 07:18:21 +08:00
|
|
|
#[error("failed to prepare Component compilation cache {path}: {source}")]
|
|
|
|
|
CacheDirectory {
|
|
|
|
|
path: PathBuf,
|
|
|
|
|
#[source]
|
|
|
|
|
source: std::io::Error,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
#[error("invalid Component compilation cache configuration: {0}")]
|
|
|
|
|
CacheConfiguration(#[source] wasmtime::Error),
|
|
|
|
|
|
2026-07-27 04:59:33 +08:00
|
|
|
#[error("failed to read component artifact {path}: {source}")]
|
|
|
|
|
ArtifactRead {
|
|
|
|
|
path: String,
|
|
|
|
|
#[source]
|
|
|
|
|
source: std::io::Error,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
#[error("failed to spawn actor thread: {0}")]
|
|
|
|
|
ActorThread(#[source] std::io::Error),
|
|
|
|
|
|
|
|
|
|
#[error("actor initialization failed: {0}")]
|
|
|
|
|
ActorInitialization(String),
|
|
|
|
|
|
|
|
|
|
#[error("actor for {0} is unavailable")]
|
|
|
|
|
ActorUnavailable(ServiceKey),
|
|
|
|
|
|
|
|
|
|
#[error("actor mailbox for {0} is full")]
|
|
|
|
|
ActorOverloaded(ServiceKey),
|
|
|
|
|
|
|
|
|
|
#[error("actor for {0} stopped before returning a result")]
|
|
|
|
|
ActorStopped(ServiceKey),
|
|
|
|
|
|
2026-07-30 07:40:08 +08:00
|
|
|
#[error("service revision {0} does not export the resident actor interface")]
|
|
|
|
|
NotResident(ServiceKey),
|
|
|
|
|
|
|
|
|
|
#[error("resident event for {service} exceeds the {limit}-byte payload limit")]
|
|
|
|
|
ResidentEventTooLarge { service: ServiceKey, limit: usize },
|
|
|
|
|
|
|
|
|
|
#[error("resident event for {service} returned more than {limit} effects")]
|
|
|
|
|
TooManyResidentEffects { service: ServiceKey, limit: usize },
|
|
|
|
|
|
|
|
|
|
#[error("invalid resident effect: {0}")]
|
|
|
|
|
InvalidResidentEffect(String),
|
|
|
|
|
|
2026-07-27 04:59:33 +08:00
|
|
|
#[error("input for {service} exceeds the {limit}-byte limit")]
|
|
|
|
|
InputTooLarge { service: ServiceKey, limit: usize },
|
|
|
|
|
|
|
|
|
|
#[error("output for {service} exceeds the {limit}-byte limit")]
|
|
|
|
|
OutputTooLarge { service: ServiceKey, limit: usize },
|
|
|
|
|
|
|
|
|
|
#[error("actor for {service} exceeded its {deadline:?} execution deadline")]
|
|
|
|
|
DeadlineExceeded {
|
|
|
|
|
service: ServiceKey,
|
|
|
|
|
deadline: Duration,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
#[error("actor for {service} faulted: {message}")]
|
|
|
|
|
ActorFault {
|
|
|
|
|
service: ServiceKey,
|
|
|
|
|
message: String,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
#[error("component returned {kind}: {message}")]
|
|
|
|
|
ComponentError { kind: &'static str, message: String },
|
|
|
|
|
|
|
|
|
|
#[error("runtime lock was poisoned")]
|
|
|
|
|
LockPoisoned,
|
|
|
|
|
}
|