zerodds_routing_service/error.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! Error type for the routing service.
5
6use thiserror::Error;
7
8/// Result alias for routing-service operations.
9pub type Result<T> = core::result::Result<T, RoutingError>;
10
11/// Failure modes of the routing service.
12#[derive(Debug, Error)]
13pub enum RoutingError {
14 /// Invalid or unparseable configuration.
15 #[error("config error: {0}")]
16 Config(String),
17
18 /// A DDS participant/reader/writer could not be created or used.
19 #[error("dds runtime error: {0}")]
20 Dds(String),
21
22 /// A route references a type that could not be resolved into a DynamicData
23 /// shape (required for content filtering or transformation).
24 #[error("type shape unavailable for route '{route}': {reason}")]
25 TypeShape {
26 /// Route name.
27 route: String,
28 /// Why the shape could not be resolved.
29 reason: String,
30 },
31
32 /// A content-filter expression failed to parse.
33 #[error("filter error in route '{route}': {reason}")]
34 Filter {
35 /// Route name.
36 route: String,
37 /// Parser/binding failure detail.
38 reason: String,
39 },
40
41 /// A transform rule was invalid for the route's type.
42 #[error("transform error in route '{route}': {reason}")]
43 Transform {
44 /// Route name.
45 route: String,
46 /// Detail.
47 reason: String,
48 },
49
50 /// Internal lock poisoned.
51 #[error("internal: {0}")]
52 Internal(&'static str),
53}