pub enum XacroError {
Show 36 variants
WithContext {
source: Box<XacroError>,
context: ErrorContext,
},
Io(Error),
Xml(ParseError),
Include(String),
UndefinedMacro(String),
MissingParameter {
macro_name: String,
param: String,
},
MissingAttribute {
element: String,
attribute: String,
},
PropertyNotFound(String),
EvalError {
expr: String,
source: EvalError,
},
XmlWrite(Error),
Utf8(FromUtf8Error),
MacroRecursionLimit {
depth: usize,
limit: usize,
},
BlockParameterWithDefault {
param: String,
},
InvalidParameterName {
param: String,
},
UnbalancedQuote {
quote_char: char,
params_str: String,
},
MissingBlockParameter {
macro_name: String,
param: String,
},
UnusedBlock {
macro_name: String,
extra_count: usize,
},
UndefinedBlock {
name: String,
},
DuplicateParamDeclaration {
param: String,
},
BlockParameterAttributeCollision {
param: String,
},
InvalidMacroParameter {
param: String,
reason: String,
},
InvalidForwardSyntax {
param: String,
hint: String,
},
UndefinedPropertyToForward {
macro_name: String,
param: String,
forward_name: String,
},
InvalidScopeAttribute {
property: String,
scope: String,
},
YamlLoadError {
path: String,
source: Error,
},
YamlParseError {
path: String,
message: String,
},
UnimplementedFeature(String),
MissingNamespace(String),
CircularPropertyDependency {
chain: String,
},
UndefinedProperty(String),
UndefinedArgument {
name: String,
},
UnknownExtension {
ext_type: String,
},
InvalidExtension {
content: String,
reason: String,
},
MaxSubstitutionDepth {
depth: usize,
snippet: String,
},
InvalidRoot(String),
InvalidXml(String),
}Variants§
WithContext
Error with added location context
Wraps any other XacroError variant with location information (file, macro stack, include stack). This allows errors to be enriched with context as they bubble up.
Io(Error)
Xml(ParseError)
Include(String)
UndefinedMacro(String)
MissingParameter
MissingAttribute
PropertyNotFound(String)
EvalError
XmlWrite(Error)
Utf8(FromUtf8Error)
MacroRecursionLimit
BlockParameterWithDefault
InvalidParameterName
UnbalancedQuote
MissingBlockParameter
UnusedBlock
UndefinedBlock
DuplicateParamDeclaration
BlockParameterAttributeCollision
InvalidMacroParameter
InvalidForwardSyntax
UndefinedPropertyToForward
InvalidScopeAttribute
YamlLoadError
YAML file loading failed
YamlParseError
YAML parsing failed
UnimplementedFeature(String)
MissingNamespace(String)
CircularPropertyDependency
Circular property dependency detected during lazy evaluation
The chain field contains the dependency path formatted as “a -> b -> c -> a”
showing how the circular reference was formed.
UndefinedProperty(String)
UndefinedArgument
Undefined argument accessed via $(arg name)
The user tried to access an argument that was not defined in XML and was not provided via CLI.
UnknownExtension
Unknown extension type
This error occurs when a $(command …) substitution uses an unrecognized command. The set of available extensions depends on how the processor was configured.
Core extensions (always available):
- $(arg name) - Access xacro argument
- $(cwd) - Get current working directory
- $(env VAR) - Get environment variable
Additional extensions may be available if explicitly added via builder pattern.
InvalidExtension
Extension resolution failed
MaxSubstitutionDepth
Property substitution exceeded maximum depth
Indicates that iterative property substitution did not converge within the allowed number of iterations. This usually means circular or self-referential property definitions that cannot be fully resolved.
InvalidRoot(String)
Invalid root element after expansion
The root element must expand to exactly one element node. This error indicates that expansion resulted in multiple nodes, zero nodes, or a non-element node.
InvalidXml(String)
Invalid XML content
The content violates XML specification rules (e.g., forbidden sequences in comments, CDATA sections, or processing instructions).
Implementations§
Source§impl XacroError
impl XacroError
Sourcepub fn with_context(self, context: ErrorContext) -> Self
pub fn with_context(self, context: ErrorContext) -> Self
Enrich this error with location context
Wraps the error in a WithContext variant that adds file, macro stack, and include stack information. This is useful for providing better error messages that show where the error occurred.
§Example
let err = XacroError::UndefinedProperty("foo".to_string());
let enriched = err.with_context(location_ctx.to_error_context());