exception_guidance#
Structured error guidance for user-facing error messages.
ErrorGuidance can be attached to conda.CondaError via the guidance keyword
so that terminal and --json output share the same logical cause / hint structure.
Classes#
dict() -> new empty dictionary |
|
A single actionable hint with a stable |
|
Structured guidance for solution-oriented error messages. |
- class GuidanceHintTypedDict#
Bases:
TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
Initialize self. See help(type(self)) for accurate signature.
- class GuidanceHint#
A single actionable hint with a stable
hint_code.
- class ErrorGuidance#
Structured guidance for solution-oriented error messages.
When attached to a
CondaError, the display layer renders the cause and hints alongside the exception'smessage.- hints: tuple[GuidanceHint, Ellipsis] = ()#
Ordered list of actionable next steps. Rendered in order.
- classmethod from_hints(hints: collections.abc.Iterable[GuidanceHint]) ErrorGuidance | None#
Create guidance from hints, deduplicating by
hint_code.
- with_hints(hints: collections.abc.Iterable[GuidanceHint]) ErrorGuidance#
Return this guidance with additional hints appended.
Existing hints keep priority when
hint_codevalues collide.
- classmethod coerce(value: Any) ErrorGuidance | None#
Coerce value to
ErrorGuidanceorNone.- Parameters:
value --
NonereturnsNone,ErrorGuidancepasses through, adictis coerced (emptydictreturnsNone).- Returns:
Noneor anErrorGuidanceinstance.
- format(exception: conda.CondaError) str#
Format this guidance for terminal output.
- Parameters:
exception --
str(exception)is used as the headline unlesssummaryis set.- Returns:
Formatted string including the exception class name, cause, and actionable hints.