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.
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.
Implementations§
Source§impl ConversionError
impl ConversionError
Sourcepub fn with_source(
context: impl Into<String>,
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Self
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.
Sourcepub fn encrypted(context: impl Into<String>, error: EncryptionError) -> Self
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.
Sourcepub fn encrypted_with_message(
context: impl Into<String>,
error: EncryptionError,
message: impl Into<String>,
) -> Self
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.
Sourcepub fn limit(&self) -> Option<&LimitExceeded>
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.
Sourcepub fn encryption(&self) -> Option<&EncryptionError>
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
impl Debug for ConversionError
Source§impl Display for ConversionError
impl Display for ConversionError
Source§impl Error for ConversionError
impl Error for ConversionError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for ConversionError
impl !UnwindSafe for ConversionError
impl Freeze for ConversionError
impl Send for ConversionError
impl Sync for ConversionError
impl Unpin for ConversionError
impl UnsafeUnpin for ConversionError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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