Diagnostics
Validate optional context before attaching it to a multimodal error.
Every error keeps class_name, error_type, original_message,
operation, stage, modality, and source_kind. Missing context uses
"unknown". Optional fields include mime_type, mime_type_source,
size_bytes, status_code, backend, input_kind, bounded media
details, and up to eight media_profiles. Paths, media bytes, and raw
lower-level messages are omitted.
Stage values describe where a failure occurred:
source_read: retrieving bytes from a source.sniff: identifying a media format from bytes.validate: checking input or options.probeanddecode: inspecting or decoding accepted media.processandprovider_call: processing media or calling a provider.configureandroute: preparing a component or selecting a route.result: checking the output of a completed operation.unknown: the stage was not supplied or was invalid.
is_http_status(value)
Return whether a value is a non-boolean HTTP status code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
Candidate status value. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
safe_debug_info(error_class_name, supplied, *, safe_message)
Validate and bound diagnostic values before attaching them to an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error_class_name
|
str
|
Class name of the normalized error. |
required |
supplied
|
DebugInfo | None
|
Candidate diagnostic fields. Unsupported keys and malformed optional values are omitted. If the mapping itself cannot be read, the required fields are still returned with unknown context. |
required |
safe_message
|
str
|
Safe public message for the normalized error. |
required |
Returns:
| Type | Description |
|---|---|
DebugInfo
|
A |
DebugInfo
|
schema always includes |
DebugInfo
|
|
DebugInfo
|
context is represented by the literal |