Skip to main content

PdfError

Trait PdfError 

Source
pub trait PdfError: Error {
    // Required methods
    fn code(&self) -> &str;
    fn help(&self) -> Option<String>;

    // Provided method
    fn docs_url(&self) -> String { ... }
}
Expand description

Common contract for engine error types.

pdf-engine exposes errors that flow up through the pdfluent facade to customers. Implementing this trait gives every error a stable, machine-readable code, an actionable help string, and a deep link to the public error documentation site.

Required Methods§

Source

fn code(&self) -> &str

Stable machine-readable identifier for the error.

Format: SCREAMING_SNAKE_CASE (for example "PASSWORD_REQUIRED"). These codes are part of the public API contract — bindings, log pipelines, and customer error handlers depend on them, so they must not change without a deprecation cycle.

Source

fn help(&self) -> Option<String>

Human-readable, actionable help text.

Suggests what the developer should do next: a code example, a configuration switch, a check to run. Returned as Option because some variants (e.g. raw I/O wrappers) have no useful generic advice.

Provided Methods§

Source

fn docs_url(&self) -> String

Deep link to the canonical documentation page for this error.

Derived from code by lowercasing and substituting _ with -. Default implementation points at https://docs.pdfluent.dev/errors/<slug>; override only if you host your own error documentation.

Implementors§