Skip to content

Exceptions

Defines the normalized exceptions raised by gllm-guardrail.

BaseGuardrailError(message=None, *, debug_info=None)

Bases: BaseError

Base class of all normalized errors raised by gllm-guardrail.

This class is abstract and is never raised directly.

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 DebugInfo

Structured internal detail about this error.

GuardrailEngineConfigError(message=None, *, debug_info=None)

Bases: BaseGuardrailError, ValueError

Raised when a guardrail engine fails to load or merge its vendor configuration.

The original vendor exception is chained as __cause__, and its detail is stored in debug_info.

Attributes:

Name Type Description
code str

Stable error code, GLLM-GRD-ENGINE-CONFIG.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DebugInfo

Structured internal detail about this error.

GuardrailEngineInitError(message=None, *, debug_info=None)

Bases: BaseGuardrailError, RuntimeError

Raised when a guardrail engine fails to initialize its underlying vendor components.

The original vendor exception is chained as __cause__, and its detail is stored in debug_info.

Attributes:

Name Type Description
code str

Stable error code, GLLM-GRD-ENGINE-INIT.

default_message str

Message used when no message is given.

message str

The message of this error.

debug_info DebugInfo

Structured internal detail about this error.