Fault Taxonomy — Aquilia Documentation
Comprehensive guide and documentation for Fault Taxonomy in the Aquilia framework. View API reference, examples, and implementation patterns.
FAULTS / TAXONOMY & RESULTS Fault Taxonomy & Outcomes Every error in Aquilia is categorized by its severity and domain, and processed by handlers returning a strict union type called FaultResult. Severity Classification The Severity enum dictates logging urgency and retry capabilities: Severity.INFO Informational incidents. Logged at info level, requires no immediate correction. Severity.WARN Degraded application behavior. Does not stop request execution. Severity.ERROR Request failed. Aborts the thread, requires handling or returns error response. Severity.FATAL System-level crash. Stops the process or aborts the entire ASGI lifespan. Handler outcomes: FaultResult A custom fault handler determines propagation by returning one of three frozen dataclasses that comprise the FaultResult type: Instructs the engine that the fault is handled. It stops propagation and returns the enclosed Response object directly. Transforms the active error into a new fault class and continues bubbling it up the handler chain. Declines handling the fault. It escalates the error to the next outer handler in the parent scope. from aquilia.faults import Resolved, Transformed, Escalate, FaultResult from aquilia.response import Response def handle_error(fault, ctx) -> FaultResult: if fault.code == "EXPIRED_SESSION": # Resolve error, return 401 response return Resolved(Response("Session expired", status=401)) if fault.code == "RAW_DB_ERROR": # Transform error return Transformed(ApiFault("DATABASE_ERROR")) # Otherwise escalate return Escalate() Overview FaultEngine )
Go to Homepage