robot_description_builder/
yank_errors.rs

1//! A module for yanking errors.
2// TODO: RENAME?
3use std::sync::PoisonError;
4
5use thiserror::Error;
6
7use crate::{
8	utils::{ArcLock, ErroredRead, ErroredWrite},
9	Joint, Link,
10};
11
12// FIXME: Maybe not transparent?
13#[derive(Debug, Error)]
14pub enum RebuildBranchError {
15	#[error(transparent)]
16	ReadChildJoint(#[from] PoisonError<ErroredRead<ArcLock<Joint>>>),
17	#[error(transparent)]
18	ReadChildLink(#[from] PoisonError<ErroredRead<ArcLock<Link>>>),
19}
20
21// FIXME: Maybe not transparent?
22/// The errortype for `yank_link` methods.
23#[derive(Debug, Error)]
24pub enum YankLinkError {
25	#[error(transparent)]
26	RebuildBranch(#[from] RebuildBranchError),
27	/// An Error, that results from `PoisonError<RwLockReadGuard<'_, Joint>>`.
28	/// It occurs when an read attempt is made when the parent [`Joint`] of the [`Link`] being yanked is poisoned.
29	#[error(transparent)]
30	ReadParentJoint(#[from] PoisonError<ErroredRead<ArcLock<Joint>>>),
31	/// An Error, that results from `PoisonError<RwLockWriteGuard<'_, Link>>`.
32	/// It occurs when the Parent [`Link`] of the Parent [`Joint`] (GrandParent) of the [`Link`] being yanked is poisoned.
33	#[error(transparent)]
34	WriteGrandParentLink(#[from] PoisonError<ErroredWrite<ArcLock<Link>>>),
35}
36
37// FIXME: Maybe not transparent?
38#[derive(Debug, Error)]
39pub enum YankJointError {
40	#[error(transparent)]
41	RebuildBranch(#[from] RebuildBranchError),
42	#[error(transparent)]
43	WriteParentLink(#[from] PoisonError<ErroredWrite<ArcLock<Link>>>),
44	#[error(transparent)]
45	ReadYankedJoint(#[from] PoisonError<ErroredRead<ArcLock<Joint>>>),
46}