Skip to main content

Module error

Module error 

Source
Expand description

Error and warning types for structured data extraction.

This module provides two levels of diagnostics:

  • ExtractionError – fatal errors that prevent extraction from completing. These are rare; most issues are captured as warnings instead.
  • ExtractionWarning – non-fatal issues that did not prevent extraction but may affect data quality. Each warning carries a machine-readable WarningCode for programmatic handling.

§Design

The extraction pipeline is designed to be lenient: individual format failures (e.g. invalid JSON in a <script> tag) are captured as warnings so that other formats can still produce results. Only truly unrecoverable errors propagate as ExtractionError.

§Examples

use schemaorg_rs::error::{ExtractionWarning, WarningCode};

let warning = ExtractionWarning {
    message: "empty JSON-LD script tag".into(),
    source_location: None,
    code: WarningCode::MalformedJsonLd,
};

assert_eq!(warning.code, WarningCode::MalformedJsonLd);

Structs§

ExtractionWarning
A non-fatal warning produced during extraction.

Enums§

ExtractionError
Fatal extraction errors that prevent further processing.
WarningCode
Machine-readable warning codes.