Skip to main content

ConversionError

Enum ConversionError 

Source
pub enum ConversionError {
    Io(Error),
    UnknownFormat {
        hint: String,
    },
    UnsupportedFormat(InputFormat),
    Parse(String),
    Fetch(String),
    UnsupportedOption(String),
    Streaming(String),
    Browser(String),
    Panic(String),
    Timeout(String),
    WithSource {
        context: String,
        source: Box<dyn Error + Send + Sync>,
    },
}
Expand description

Anything that can go wrong while loading or converting a source document.

Variants§

§

Io(Error)

Reading the input from disk failed.

§

UnknownFormat

The file extension (or content) did not map to a known format.

Fields

§hint: String
§

UnsupportedFormat(InputFormat)

The format is known but no backend is wired up for it yet.

§

Parse(String)

The backend recognized the format but failed to parse the content.

§

Fetch(String)

Loading the input from a URL failed (#668): the SSRF guard refused it, the transfer failed or overran its bounds, or a data: URL is malformed.

§

UnsupportedOption(String)

An option the caller set names a reading the input’s backend has not implemented (#851: track_changes=all on a .doc, reject on an ODT): refused before any output, never answered with another view.

§

Streaming(String)

The requested streaming conversion is not supported (e.g. JSON, or the referenced image mode, which both need the whole document up front).

§

Browser(String)

The headless-browser pre-render (--use-web-browser) failed, or the crate was built without the web-browser feature.

§

Panic(String)

A conversion worker panicked — a backend bug reached on some input (#395/#396). The panic itself is not swallowed: it still unwinds its own thread and prints its message and backtrace to stderr. This turns it into an ordinary error for the caller, so a server answers with a 500 instead of a silent empty document and a batch keeps going.

§

Timeout(String)

The document budget (DocumentConverter::document_timeout, #497) ran out on a streaming conversion. Not a failure: every chunk emitted before it is the partial document, and this is the stream’s last item — the streaming counterpart of crate::ConversionStatus::PartialSuccess with a timeout crate::ErrorItem. Buffered conversions never raise it; they report the cut on the result.

§

WithSource

A dependency failed during conversion. Unlike ConversionError::Parse the underlying error is kept alive (not flattened into a string), so callers can walk std::error::Error::source and downcast to the original type — e.g. to tell a truncated archive from malformed XML.

Fields

§context: String

What was being converted when the failure happened (backend prefix, mirroring the Parse message style: “xlsx”, “docling-json”, …).

§source: Box<dyn Error + Send + Sync>

The error that caused the failure, preserved on the chain.

Implementations§

Source§

impl ConversionError

Source

pub fn with_source( context: impl Into<String>, source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Self

Wrap a dependency error, keeping it reachable via std::error::Error::source instead of stringifying it.

Source

pub fn encrypted(context: impl Into<String>, error: EncryptionError) -> Self

The error for an encrypted context document (#636): displays as parse error: <context>: <error> — the Office wording of #624 — with the typed EncryptionError on the source chain for encryption.

Source

pub fn encrypted_with_message( context: impl Into<String>, error: EncryptionError, message: impl Into<String>, ) -> Self

encrypted with a backend’s own wording: message is what the error displays (after parse error: <context>: ), the typed value stays the cause. For the readers whose text predates the type (iWork, WordPerfect) — nothing a user or a test reads changed when the value arrived.

Source

pub fn limit(&self) -> Option<&LimitExceeded>

The typed limit when this error says the input asked for more than a safety cap allows (#861: a docling-JSON, DocTags or DocLang table past DOCLING_RS_MAX_TABLE_CELLS / _MAX_TOTAL_TABLE_CELLS): anywhere on the source chain, so a caller names the variable to raise instead of matching message text. None for every other failure.

Source

pub fn encryption(&self) -> Option<&EncryptionError>

The typed reason when this error says the document is encrypted (#636): anywhere on the source chain — the PDF reader’s docling_pdf::PdfError::Encrypted, the Office decryptor’s value, an iWork or WordPerfect backend’s — so a caller prompts for a password on EncryptionError::needs_password instead of matching message text. None for every other failure.

Trait Implementations§

Source§

impl Debug for ConversionError

Source§

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

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

impl Display for ConversionError

Source§

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

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

impl Error for ConversionError

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 ConversionError

Source§

fn from(e: Error) -> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V