cleverly.exceptions.Refusal#
- class cleverly.exceptions.Refusal(reason: RefusalReason, condition: str, alternative: str | None = None, roadmap: str | None = None)[source]#
One refusal: its reason code, the failed condition, and what to do instead.
- Parameters:
- reason
RefusalReason Where the problem is.
- condition
str The sentences that state the failed condition. They end with a full stop. A condition that a raise splices into a longer message can open with a lowercase word.
- alternative
strorNone The sentence that names a working call, or
NO_ALTERNATIVE. Required for every code exceptRefusalReason.INVALID_DECLARATION.- roadmap
strorNone The id of the
docs/roadmap.mditem that tracks a missing capability, such as"F21". AnRefusalReason.IMPLEMENTATION_GAPrefusal always names one.
- reason
- Raises:
TypeErrorWhen
reasonis not aRefusalReason, whenconditionis empty, or when a code that needs an alternative has none.
Methods#
Attributes#
- Refusal.reason: RefusalReason#