behaviortree_core/
error.rs1use thiserror::Error;
5
6use crate::ConstString;
7
8use super::BehaviorState;
9
10#[derive(Error, Debug)]
12pub enum Error {
13 #[error("the item {name} is already registered")]
15 AlreadyRegistered {
16 name: ConstString,
18 },
19 #[error("behavior composition error: {txt}")]
21 Composition {
22 txt: ConstString,
24 },
25 #[error("a 'blackboard' error occured: {0}")]
27 Databoard(#[from] databoard::Error),
28 #[error("a 'port' error occured: {0}")]
30 Dataport(#[from] dataport::Error),
31 #[error("a deserialization error occured: {0}")]
33 Nanoserde(#[from] nanoserde::DeJsonErr),
34 #[error("the attribute '{value}' is no pre or post condition")]
36 NoCondition {
37 value: ConstString,
39 },
40 #[error("value {value} is not a boolean type")]
42 NotABool {
43 value: ConstString,
45 },
46 #[error("could not parse value '{value}' in {src}")]
48 ParseError {
49 value: ConstString,
51 src: ConstString,
53 },
54 #[error("could not parse int value: {0}")]
56 ParseInt(#[from] core::num::ParseIntError),
57 #[error("could not parse value for port {port} into specified type {typ}")]
59 ParsePortValue {
60 port: ConstString,
62 typ: ConstString,
64 },
65 #[error("port {port} is not declared in behavior {behavior}")]
67 PortNotDeclared {
68 port: ConstString,
70 behavior: ConstString,
72 },
73 #[error("a scripting error occured: {0}")]
75 Scripting(#[from] tinyscript::Error),
76 #[error("child node of {behavior} returned state {state} when not allowed")]
78 State {
79 behavior: ConstString,
81 state: BehaviorState,
83 },
84 #[error("unable to set the pre or post condition {value})")]
86 UnableToSetCondition {
87 value: ConstString,
89 },
90}