actor_sample/order_actor/
error.rs1use crate::product_actor::ProductError;
4use crate::user_actor::UserError;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
12#[allow(dead_code)]
13pub enum OrderError {
14 #[error("Order not found: {0}")]
16 NotFound(String),
17
18 #[error("Invalid product: {0}")]
20 InvalidProduct(String),
21
22 #[error("Invalid user: {0}")]
24 InvalidUser(String),
25
26 #[error("Insufficient stock: {0}")]
28 InsufficientStock(String),
29
30 #[error("Order validation error: {0}")]
32 ValidationError(String),
33
34 #[error("User service error: {0}")]
36 UserService(#[from] UserError),
37
38 #[error("Product service error: {0}")]
40 ProductService(#[from] ProductError),
41
42 #[error("Order database error: {0}")]
44 DatabaseError(String),
45
46 #[error("Actor communication error: {0}")]
48 ActorCommunicationError(String),
49}
50
51impl From<String> for OrderError {
52 fn from(msg: String) -> Self {
53 OrderError::ActorCommunicationError(msg)
54 }
55}