generated from john/python-template
@@ -107,12 +107,16 @@ user-facing envelopes must not carry it. `AppError` therefore separates the two
|
||||
| Field | Audience | Carries root cause | Surfaces |
|
||||
| --- | --- | --- | --- |
|
||||
| `message` | User-facing and API-facing | No | `show_error`, `build_error_envelope` |
|
||||
| `detail` | Internal only | Yes | `format_error_detail` (evidence), logs |
|
||||
| `detail` | Internal only | Yes | `format_error_detail` (evidence), logs, sanitized UI projection only |
|
||||
|
||||
`classify_unexpected_error` builds a generic `message` and puts the exception type and
|
||||
text on `detail`. Anything rendered to a user or serialized into an API envelope must
|
||||
read `message`; anything persisted as provenance or logged may read `detail`.
|
||||
Enforced by `tests/test_errors.py::test_unexpected_error_does_not_leak_filesystem_paths`.
|
||||
read `message`; anything persisted as provenance or logged may read `detail`. When a UI
|
||||
surface needs to show persisted `error_detail`, it must route through a sanitizing
|
||||
projection that preserves the category, suggestion, and error reference while reducing
|
||||
machine-local absolute paths to basenames only.
|
||||
Enforced by `tests/test_errors.py::test_unexpected_error_does_not_leak_filesystem_paths`
|
||||
and `tests/test_error_message_safety.py`.
|
||||
|
||||
## Operator Recovery Guidance
|
||||
|
||||
|
||||
@@ -747,11 +747,11 @@ set-membership.
|
||||
def exception_detail(exc: BaseException) -> str:
|
||||
"""Internal-only root-cause text for AppError.detail. Never user-facing."""
|
||||
|
||||
def filesystem_error[E: AppError](
|
||||
error_type: type[E], message: str, exc: OSError, *, suggestion: str
|
||||
) -> E:
|
||||
|
||||
def filesystem_error[E: AppError](error_type: type[E], message: str, exc: OSError, *, suggestion: str) -> E:
|
||||
"""Build a filesystem AppError with a generic message and the path on detail."""
|
||||
|
||||
|
||||
# src/transcription/ui/components/error_presenter.py
|
||||
def display_failure_detail(error_detail: str | None) -> str | None:
|
||||
"""Sanitize persisted failure detail for UI rendering (HIGH-01)."""
|
||||
|
||||
Reference in New Issue
Block a user