intellicrack.core.error_logging
Error-logging helpers for typed-exception passthrough patterns.
These helpers exist so every except ... : raise site emits a structured log event before re-raising, satisfying the project rule that
every except clause must log even when re-raising. Centralizing the pattern keeps call sites terse and consistent across providers, bridges,
and core modules.
- log_passthrough(logger, event, exc, **context)[source]
Emit a structured warning event describing an exception about to be re-raised.
Callers are expected to follow the call with a bare
raise(inside anexcept ... as exc:block) so the original traceback is preserved. The helper does not raise itself, which keeps theraisestatement visible to static analysers (pydoclint, basedpyright) that infer documentedRaises:clauses from the function body.- Parameters:
logger (structlog.stdlib.BoundLogger) – BoundLogger to emit the event on.
event (str) – Stable snake_case event name (e.g.
"ollama_list_tags_passthrough").exc (BaseException) – Exception being re-raised; only its
str()and class name are recorded.**context (object) – Additional structured kwargs (provider, model, op, etc.).
- Return type:
None