Faults — Aquilia Documentation
Comprehensive guide and documentation for Faults in the Aquilia framework. View API reference, examples, and implementation patterns.
Security & Auth Auth Faults Reference Aquilia auth uses structured Fault objects for all error conditions. Each fault carries a domain, code, severity, public-safe message, and retryable flag — enabling consistent error handling across your application. Fault Structure from aquilia.auth.faults import ( Fault, # base class raise_auth_fault, # raise helper is_auth_fault, # type check helper ) # Every auth fault provides: class Fault: domain: str # e.g. "auth" code: str # e.g. "AUTH_001" severity: str # "critical" | "error" | "warning" message: str # internal message (log-safe) public_message: str # user-facing message retryable: bool # can the client retry? status_code: int # HTTP status code (401, 403, etc.) Authentication Faults Code Name Description Status Retry ))} Authorization Faults Code Name Description Status Retry ))} Credential Faults Code Name Description Status Retry ))} Session Faults Code Name Description Status Retry ))} OAuth Faults Code Name Description Status Retry ))} MFA Faults Code Name Description Status Retry ))} Handling Auth Faults from aquilia.auth.faults import is_auth_fault, Fault # In your route handler async def login(request): try: result = await auth_manager.authenticate_password( identifier="alice@example.com", password=request.body["password"], ) return json( ) except Fault as fault: # Generic auth fault response — always use public_message return json( , status=fault.status_code) )
Go to Homepage