Python

MaelysDatalogError

MaelysDatalogError class and public members in the unified Python API.

Class: MaelysDatalogError

Python · exceptionSince v0.10.0
MaelysDatalogError
Declaration
class MaelysDatalogError(RuntimeError):
RuntimeError subclass raised on a failed native operation. status and code are the same integer operation status; message and hint are str; diagnostic is a Diagnostic record with its own reason code. Catch native failures separately from malformed Python arguments.
Creation and access

Internal constructor — do not call. Raised by native operations; consumers catch and inspect the exception rather than construct a native failure.

  • raised by
    Native binding operations

    Catch native operation failures to inspect their status and copied diagnostic; a false query answer is not an exception.

Attributes
codeintproperty
Alias of error.status; not the diagnostic reason code.
statusintproperty
Native operation status; compare with Status members.
messagestrproperty
Human-readable detail.
hintstrproperty
Suggested corrective action when supplied.
diagnosticDiagnosticproperty
Structured native detail, including its distinct reason code and presence mask.
Example
from maelys_datalog import MaelysDatalogError, Status

try:
    edb.add_fact("owns", ["alice", "roadmap.pdf"])
    result = session.solve(edb)
except MaelysDatalogError as error:
    print("status:", Status(error.status).name)
    print("message:", error.message)
    print("hint:", error.hint)
status: PAYLOAD_TOO_LARGE
message: Appending 1 entries to 1 exceeds input EDB capacity 1 (before deduplication).
hint: No facts were appended. Batch fact/term indices are zero-based; correct the batch and retry.

Receiving a MaelysDatalogError

A failed native operation raises this exception. Application code normally catches it rather than constructs it; malformed Python arguments may instead raise TypeError, ValueError or OverflowError.

Usage guides