Skip to main content

XacroError

Enum XacroError 

Source
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.

Fields

§source: Box<XacroError>
§

Io(Error)

§

Xml(ParseError)

§

Include(String)

§

UndefinedMacro(String)

§

MissingParameter

Fields

§macro_name: String
§param: String
§

MissingAttribute

Fields

§element: String
§attribute: String
§

PropertyNotFound(String)

§

EvalError

Fields

§expr: String
§source: EvalError
§

XmlWrite(Error)

§

Utf8(FromUtf8Error)

§

MacroRecursionLimit

Fields

§depth: usize
§limit: usize
§

BlockParameterWithDefault

Fields

§param: String
§

InvalidParameterName

Fields

§param: String
§

UnbalancedQuote

Fields

§quote_char: char
§params_str: String
§

MissingBlockParameter

Fields

§macro_name: String
§param: String
§

UnusedBlock

Fields

§macro_name: String
§extra_count: usize
§

UndefinedBlock

Fields

§name: String
§

DuplicateParamDeclaration

Fields

§param: String
§

BlockParameterAttributeCollision

Fields

§param: String
§

InvalidMacroParameter

Fields

§param: String
§reason: String
§

InvalidForwardSyntax

Fields

§param: String
§hint: String
§

UndefinedPropertyToForward

Fields

§macro_name: String
§param: String
§forward_name: String
§

InvalidScopeAttribute

Fields

§property: String
§scope: String
§

YamlLoadError

YAML file loading failed

Fields

§path: String
§source: Error
§

YamlParseError

YAML parsing failed

Fields

§path: String
§message: String
§

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.

Fields

§chain: String
§

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.

Fields

§name: String
§

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.

Fields

§ext_type: String
§

InvalidExtension

Extension resolution failed

Fields

§content: String
§reason: String
§

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.

Fields

§depth: usize
§snippet: String
§

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

Source

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());

Trait Implementations§

Source§

impl Debug for XacroError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for XacroError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for XacroError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for XacroError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<EmitterError> for XacroError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<EvalError> for XacroError

Source§

fn from(e: EvalError) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for XacroError

Source§

fn from(source: FromUtf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for XacroError

Source§

fn from(source: ParseError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.