Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 14 variants Io(Error), Zip(ZipError), Xml(Error), XmlAttr(String), MissingFile(String), InvalidFormat(String), InvalidXml(String), InvalidModel(String), OutsidePositiveOctant(usize, f64, f64, f64), ParseError(String), Unsupported(String), UnsupportedExtension(String), InvalidSecureContent(String), XmlWrite(String),
}
Expand description

Errors that can occur when parsing 3MF files

Variants§

§

Io(Error)

IO error occurred while reading the file

Error Code: E1001

Common Causes:

  • File not found
  • Insufficient permissions
  • Disk read error
§

Zip(ZipError)

ZIP archive error

Error Code: E1002

Common Causes:

  • Corrupted ZIP file
  • Unsupported compression method
  • Truncated archive

Suggestions:

  • Verify the file is a valid 3MF (ZIP) archive
  • Try re-downloading or re-exporting the file
§

Xml(Error)

XML parsing error

Error Code: E2001

Common Causes:

  • Malformed XML syntax
  • Invalid character encoding
  • Unclosed tags
§

XmlAttr(String)

XML attribute error

Error Code: E2002

Common Causes:

  • Missing required attribute
  • Invalid attribute value
  • Duplicate attribute

Suggestions:

  • Check the 3MF specification for required attributes
  • Verify attribute values are properly formatted
§

MissingFile(String)

Missing required file in the 3MF archive

Error Code: E1003

Common Causes:

  • Incomplete 3MF package
  • Missing 3D model file
  • Missing content types file

Suggestions:

  • Ensure the 3MF archive contains all required files
  • Check for [Content_Types].xml and 3D/3dmodel.model files
§

InvalidFormat(String)

Invalid 3MF format

Error Code: E2004

Common Causes:

  • Non-compliant OPC structure
  • Invalid content types
  • Missing required OPC relationships

Suggestions:

  • Verify the file was exported correctly
  • Check the 3MF specification for OPC requirements
§

InvalidXml(String)

Invalid XML structure

Error Code: E2003

Common Causes:

  • Missing required XML elements
  • Elements in wrong order
  • Invalid element nesting

Suggestions:

  • Check element hierarchy matches 3MF specification
  • Verify required child elements are present
§

InvalidModel(String)

Invalid model structure or validation failure

Error Code: E3001

Common Causes:

  • Mesh topology errors (non-manifold, degenerate triangles)
  • Invalid object references
  • Out-of-bounds vertex indices
  • Duplicate object IDs

Suggestions:

  • Check mesh for manifold edges (each edge shared by at most 2 triangles)
  • Verify all vertex indices are within bounds
  • Ensure all object IDs are unique and positive
  • Validate all references point to existing objects
§

OutsidePositiveOctant(usize, f64, f64, f64)

Geometry placed outside the positive octant

Error Code: E3003

Common Causes:

  • Build item transforms place mesh vertices with negative coordinates
  • Object positioned below build plate (negative Z)
  • Object positioned with negative X or Y coordinates

Suggestions:

  • Per 3MF spec, all coordinates must be non-negative (>= 0)
  • Adjust build item transforms to ensure all geometry is in positive octant
  • Check that final transformed coordinates (after applying transforms) are >= 0

Details: Object ID: {0}, Min coordinates: ({1:.2}, {2:.2}, {3:.2})

§

ParseError(String)

Parse error for numeric values

Error Code: E3002

Common Causes:

  • Invalid number format
  • Out-of-range values
  • Non-numeric characters in numeric fields

Suggestions:

  • Verify numeric values use proper format (e.g., “1.5” not “1,5”)
  • Check for special characters or extra whitespace
§

Unsupported(String)

Unsupported feature or extension

Error Code: E4001

Common Causes:

  • Using 3MF extensions not implemented by this parser
  • Future 3MF specification features

Suggestions:

  • Check if the feature is part of a 3MF extension
  • Verify this parser supports the required extensions
§

UnsupportedExtension(String)

Required extension not supported

Error Code: E4002

Common Causes:

  • 3MF file requires an extension not implemented by this parser
  • Extension marked as required in the XML namespace

Suggestions:

  • Check the file’s required extensions in the model XML
  • Use a different parser that supports the required extension
  • If possible, re-export without the extension
§

InvalidSecureContent(String)

Invalid SecureContent keystore

Error Code: E4003

Common Causes:

  • Invalid consumer index reference (EPX-2601)
  • Missing consumer element when accessright is defined (EPX-2602)
  • Invalid encryption algorithm (EPX-2603)
  • Duplicate consumer IDs (EPX-2604)
  • Invalid encrypted file path (EPX-2605)
  • Missing required keystore elements (EPX-2606)
  • Referenced file doesn’t exist in package (EPX-2607)

Suggestions:

  • Verify the keystore.xml follows the 3MF SecureContent specification
  • Check consumer definitions and accessright references
  • Ensure all referenced files exist in the package
§

XmlWrite(String)

XML writing error

Error Code: E2005

Common Causes:

  • Failed to serialize XML
  • Invalid data for XML writing
  • I/O error during writing

Suggestions:

  • Check that data structures are valid
  • Ensure output stream is writable

Implementations§

Source§

impl Error

Source

pub fn error_type(&self) -> &'static str

Get the error type as a string for matching against expected failures

This returns a stable identifier for the error variant, useful for testing and validation purposes.

Source

pub fn invalid_xml_element(element: &str, message: &str) -> Self

Create an InvalidXml error with element context

§Arguments
  • element - The XML element name where the error occurred
  • message - Description of the error
§Example
Error::invalid_xml_element("vertex", "Missing required 'x' attribute")
Source

pub fn missing_attribute(element: &str, attribute: &str) -> Self

Create an InvalidXml error for a missing required attribute

§Arguments
  • element - The XML element name
  • attribute - The missing attribute name
§Example
Error::missing_attribute("object", "id")
Source

pub fn invalid_format_context(context: &str, message: &str) -> Self

Create an InvalidFormat error with context about what file/structure is invalid

§Arguments
  • context - What part of the format is invalid (e.g., “OPC structure”, “Content types”)
  • message - Description of the error
Source

pub fn parse_error_with_context( field_name: &str, value: &str, expected_type: &str, ) -> Self

Create a ParseError with context about what was being parsed

§Arguments
  • field_name - The name of the field being parsed (e.g., “vertex x coordinate”)
  • value - The value that failed to parse
  • expected_type - The expected type (e.g., “floating-point number”)
Source

pub fn xml_write(message: String) -> Self

Create an XmlWrite error

§Arguments
  • message - Description of the writing error

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<AttrError> for Error

Source§

fn from(err: AttrError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ParseFloatError> for Error

Source§

fn from(err: ParseFloatError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseIntError> for Error

Source§

fn from(err: ParseIntError) -> Self

Converts to this type from the input type.
Source§

impl From<ZipError> for Error

Source§

fn from(source: ZipError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl !UnwindSafe for Error

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.