82 lines
2.3 KiB
Rust
82 lines
2.3 KiB
Rust
|
|
//! Runtime error taxonomy exposed to management layers.
|
||
|
|
|
||
|
|
use std::time::Duration;
|
||
|
|
|
||
|
|
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),
|
||
|
|
|
||
|
|
#[error("runtime creation failed: {0}")]
|
||
|
|
RuntimeCreation(#[source] wasmtime::Error),
|
||
|
|
|
||
|
|
#[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),
|
||
|
|
|
||
|
|
#[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,
|
||
|
|
}
|