Skip to main content

Module error

Module error 

Source
Expand description

Error types for MARC operations.

Provides MarcError for all MARC library operations and the Result convenience type. Each variant carries structured positional metadata describing where in a stream/record/field the problem occurred — see the per-variant requirements in the documentation for which fields are always populated, may be populated, or are not applicable.

All variants are Send + Sync so errors can cross thread boundaries used by the parallel parsing paths.

Structs§

BytesNear
Byte window captured near the point of an error, used to render a hex dump in MarcError::detailed output.
ErrorMetadata
Borrowed snapshot of the structured metadata carried by a MarcError.

Enums§

MarcError
Error type for all MARC library operations.

Constants§

BYTES_NEAR_AFTER
Number of bytes retained after the error offset in BytesNear.
BYTES_NEAR_BEFORE
Number of bytes retained before the error offset in BytesNear.
DOCS_BASE_URL
Base URL for the docs site. Used by MarcError::help_url.
FOUND_BYTES_CAP
Maximum length in bytes retained in a MarcError’s found field.
SCHEMA_VERSION
Schema identifier included in MarcError::to_json_value output so consumers can branch on it if the shape changes later. Pre-1.0, the shape may still evolve.

Functions§

empty_errors_arc
Shared empty Arc<Vec<MarcError>> used as the default value for the errors field on freshly constructed records. Returned by Record::new / AuthorityRecord::new / HoldingsRecord::new and kept as-is by readers when no errors accumulate during a parse.
render_hex_dump
Render a BytesNear window as a hex + ASCII dump, with an optional caret pointing at the offending byte.
truncate_bytes
Truncate a byte slice to at most FOUND_BYTES_CAP bytes.

Type Aliases§

Result
Convenience type alias for std::result::Result with MarcError.