use thiserror::Error;
use crate::ConstString;
#[derive(Error, Debug)]
pub enum Error {
#[error("the attribute '_autoremap' is only allowed for subtrees not for '{tag}'")]
Autoremap {
tag: ConstString,
},
#[error("the value for autoremap must be a boolean 'true' or 'false'")]
AutoremapValue,
#[error("the attribute 'BTCPP_format' must have the value '4'")]
BtCppFormat,
#[error("the leaf behavior '{behavior}' may not have any children")]
ChildrenNotAllowed {
behavior: ConstString,
},
#[error("the pre-/post-condition key '{key}' is erronous: {source}")]
Condition {
key: ConstString,
source: crate::error::Error,
},
#[error("port '{port}' could not be initialized from str '{value}'")]
ConversionFromStr { port: ConstString, value: ConstString },
#[error("the databoard key '{key}' caused the error: {source}")]
Databoard {
key: ConstString,
source: databoard::Error,
},
#[error("the port '{key}' caused the error: {source}")]
Dataport {
key: ConstString,
source: dataport::Error,
},
#[error("the behavior definition for the id '{id}' could not be found")]
DefinitionNotFound {
id: ConstString,
},
#[error("definition for '{tree}' does not contain a 'BehaviorTree' tag")]
MissingBehaviorTree {
tree: ConstString,
},
#[error("the tag '{tag}' is missing an 'ID' attribute")]
MissingId {
tag: ConstString,
},
#[error("name for the tree (Attribute 'ID') is missing")]
MissingTreeName,
#[error("the behavior '{behavior}' is not registered")]
NotRegistered {
behavior: ConstString,
},
#[error("the behavior '{behavior}' must have exactly 1 child")]
OneChild {
behavior: ConstString,
},
#[error("the port '{port}' is not in {behavior}'s portlist")]
PortInvalid {
port: ConstString,
behavior: ConstString,
},
#[error("the value {value} is not valid as PortType")]
PortType {
value: ConstString,
},
#[error("the name for the 'root' element must be 'root'")]
RootName,
#[error("the attribute with key '{key}' is unknown")]
UnknownAttribute {
key: ConstString,
},
#[error("the element '{tag}' under '{parent}' is not supported")]
UnsupportedElement {
tag: ConstString,
parent: ConstString,
},
#[cfg(feature = "std")]
#[error("the tag '{tag}' is missing a 'path' attribute")]
MissingPath {
tag: ConstString,
},
#[cfg(feature = "std")]
#[error("file '{name}' could not be read: {cause}")]
ReadFile {
name: ConstString,
cause: ConstString,
},
}