arci_ros/
error.rs
1use thiserror::Error;
2
3#[derive(Debug, Error)]
4#[non_exhaustive]
5pub enum Error {
6 #[error("arci_ros: No joint_state is available")]
7 NoJointStateAvailable,
8 #[error("arci_ros: length mismatch (model = {}, input = {})", model, input)]
9 LengthMismatch { model: usize, input: usize },
10 #[error("arci_ros: ActionResultTimeout")]
11 ActionResultTimeout,
12 #[error("arci_ros: ActionResultNotSuccess {}", .0)]
13 ActionResultNotSuccess(String),
14 #[error("arci_ros: ActionResultPreempted {}", .0)]
15 ActionResultPreempted(String),
16 #[error("arci_ros: ActionGoalSendingFailure")]
17 ActionGoalSendingFailure,
18 #[error("arci_ros: ActionCancelSendingFailure")]
19 ActionCancelSendingFailure,
20 #[error("arci_ros: arci: {:?}", .0)]
21 Arci(#[from] arci::Error),
22 #[error("arci_ros: Other: {:?}", .0)]
23 Other(#[from] anyhow::Error),
24}
25
26impl From<Error> for arci::Error {
27 fn from(e: Error) -> Self {
28 match e {
29 Error::Arci(e) => e,
30 e @ Error::ActionResultPreempted(_) => arci::Error::Canceled {
31 message: e.to_string(),
32 },
33 e => arci::Error::Other(e.into()),
35 }
36 }
37}