error#

nominal.experimental.extractor.decorators.error(exception_type: type[Exception], *, code: str, exit_code: int, retryable: bool = False, message: str | None = None) → _ErrorMapping#

Declare a structured failure handled by the extractor runner.

Place below @manifest_extractor or @single_file_extractor, alongside @input and @parameter. Stack declarations for different Exception subclasses; the closest class in the raised exception’s MRO wins, regardless of decorator order. Declaring the same class twice is an error. This decorator preserves the callback’s signature.

code is a nonempty catalog error code; exit_code is an integer from 1 through 255. retryable describes whether another attempt may succeed without changing the input. Codes must fit the 4,096-byte termination JSON envelope. Long messages are shortened; mapped failures retain their full traceback on stderr.

Mappings cover startup, argument binding, extraction, and output finalization. They configure runtime reporting. message optionally supplies static fallback text for both Extractor.registration_kwargs() and Extractor.catalog_manifest(); when omitted, the code supplies a readable fallback truncated to 512 characters. Runtime messages come from the exception. Both exports validate and combine exit-code fallbacks. run(exit=False) and direct callback invocation propagate errors without reporting.