lambda_simulator/
error.rs1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum SimulatorError {
8 #[error("Failed to start server: {0}")]
10 ServerStart(String),
11
12 #[error("Failed to bind to address: {0}")]
14 BindError(String),
15
16 #[error("Invalid configuration: {0}")]
18 InvalidConfiguration(String),
19
20 #[error("Timeout occurred: {0}")]
22 Timeout(String),
23
24 #[error("Invocation not found: {0}")]
26 InvocationNotFound(String),
27}
28
29#[derive(Error, Debug)]
31pub enum RuntimeError {
32 #[error("Request ID not found: {0}")]
34 RequestIdNotFound(String),
35
36 #[error("Invalid request ID format: {0}")]
38 InvalidRequestId(String),
39
40 #[error("No invocation available")]
42 NoInvocation,
43
44 #[error("Runtime not initialized")]
46 NotInitialized,
47
48 #[error("Runtime already initialized")]
50 AlreadyInitialized,
51
52 #[error("Invalid payload: {0}")]
54 InvalidPayload(String),
55}
56
57#[derive(Error, Debug)]
59pub enum BuilderError {
60 #[error("Missing required field: {0}")]
62 MissingField(String),
63
64 #[error("Invalid freeze configuration: {0}")]
66 InvalidFreezeConfig(String),
67}
68
69pub type SimulatorResult<T> = Result<T, SimulatorError>;
71
72pub type RuntimeResult<T> = Result<T, RuntimeError>;