#[non_exhaustive]pub enum Error {
Io(Error),
Package(PackageError),
Xml(XmlError),
Placement(BindingError),
Plan(PlanError),
Render(RenderError),
Context(ContextError),
}Expand description
Top-level error type for docx-templating.
This enum wraps domain-specific errors and provides automatic conversions
via From implementations powered by thiserror.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Io(Error)
I/O error (file operations, ZIP reading/writing).
Package(PackageError)
DOCX package validation or ZIP handling error.
Xml(XmlError)
XML processing error.
Placement(BindingError)
Template placement or binding error.
Plan(PlanError)
Render plan error.
Render(RenderError)
Template rendering error.
Context(ContextError)
Context data error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_missing_value(&self) -> bool
pub fn is_missing_value(&self) -> bool
Whether this error is a missing template value.
Use it to tell a missing field apart from a malformed template when the
caller wants to fall back to
MissingValuePolicy::Empty.
§Examples
use docx_templating::{Error, RenderError};
let error = Error::Render(RenderError::MissingValue {
path: "user.name".to_owned(),
part: Some("word/document.xml".to_owned()),
});
assert!(error.is_missing_value());Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<BindingError> for Error
impl From<BindingError> for Error
Source§fn from(source: BindingError) -> Self
fn from(source: BindingError) -> Self
Converts to this type from the input type.
Source§impl From<ContextError> for Error
impl From<ContextError> for Error
Source§fn from(source: ContextError) -> Self
fn from(source: ContextError) -> Self
Converts to this type from the input type.
Source§impl From<PackageError> for Error
impl From<PackageError> for Error
Source§fn from(source: PackageError) -> Self
fn from(source: PackageError) -> Self
Converts to this type from the input type.
Source§impl From<RenderError> for Error
impl From<RenderError> for Error
Source§fn from(source: RenderError) -> Self
fn from(source: RenderError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Errorwhere
*const () is !null: Freeze,
PhantomData<ErrorData<CustomOwner>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
&'static str: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Option<usize>>: Freeze,
*const ErrorImpl is !null: Freeze,
PhantomData<ErrorImpl>: Freeze,
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Errorwhere
*const () is !null: UnsafeUnpin,
PhantomData<ErrorData<CustomOwner>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
&'static str: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Option<usize>>: UnsafeUnpin,
*const ErrorImpl is !null: UnsafeUnpin,
PhantomData<ErrorImpl>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more