Skip to content

Exceptions

Defines the exceptions shared across gllm-docproc.

AttributeNotFoundError(message=None, *, component=None, error=None)

Bases: BaseDocProcError, AttributeError

Error raised when a module is asked for a name it does not define.

It is still an AttributeError, so hasattr, getattr with a default, and from ... import keep working.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-ATTRIBUTE-NOT-FOUND.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

BaseDocProcError(message=None, *, component=None, error=None)

Bases: BaseError

Root of the normalized errors raised by gllm-docproc.

This class is abstract and is never raised directly. Every concrete subclass defines its own code (GLLM-DPO-<NAME>) and default_message.

Attributes:

Name Type Description
code str | None

Stable error code. Defined by each concrete subclass.

default_message str | None

Message used when no message is given. Defined by each concrete subclass.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

reference_id str

Random 12-character hex id of this occurrence, generated at construction so it can be matched with the log entry.

Initializes the error.

Parameters:

Name Type Description Default
message str | None

Message overriding default_message. Defaults to None.

None
component str | None

Class name of the component that first wrapped this error. Defaults to None.

None
error Exception | None

Original error, when one was caught. Defaults to None.

None

ChunkNotFoundError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Raised when an indexed chunk does not exist.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-CHUNK-NOT-FOUND.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

DocProcDebugInfo

Bases: DebugInfo

Docproc extension of DebugInfo.

Attributes:

Name Type Description
class_name str

Name of the exception class. Always present.

error_type str

Type name of the original error, when one was caught.

original_message str

Message of the original error, when one was caught.

traceback str

Formatted traceback of the original error, when one was caught.

component str

Class name of the component that first wrapped this error, when available.

InvalidConfigError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Raised when a component is given an invalid configuration or option.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-INVALID-CONFIG.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

InvalidFileError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Raised when a component is given a file whose content it cannot read.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-INVALID-FILE.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

MissingDependencyError(message=None, *, component=None, error=None)

Bases: BaseDocProcError, ImportError

Error raised when an optional dependency is not installed.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-MISSING-DEPENDENCY.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

OperationNotImplementedError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Raised when a component has no implementation yet.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-OPERATION-NOT-IMPLEMENTED.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

RequestFailedError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Error raised when a remote call fails.

Covers a connection that failed or timed out, a protocol error, an error status, a bad URL, a body that is not valid JSON, or a connector that returns an error instead of a file.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-REQUEST-FAILED.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

SourceNotFoundError(message=None, *, component=None, error=None)

Bases: BaseDocProcError, FileNotFoundError

Error raised when a source file does not exist.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-SOURCE-NOT-FOUND.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

UnexpectedError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Error raised when an unexpected error occurs.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-UNEXPECTED.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

UnsupportedFileExtensionError(message=None, *, component=None, error=None)

Bases: BaseDocProcError

Raised when a component is given a file whose extension it does not support.

Attributes:

Name Type Description
code str

Stable error code, GLLM-DPO-UNSUPPORTED-FILE-EXTENSION.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DocProcDebugInfo

Structured internal detail about this error.

new_reference_id()

Create a short ID that names one failure in the logs and in the message the user sees.

Returns:

Name Type Description
str str

A 12-character hex ID.