argdigest.DigestError#

exception argdigest.DigestError(message=None, *, context=None, detail=None, code=None, **fields)[source]#

Base class for all ArgDigest exceptions.

message comes first and every field is keyword-only. That is what makes type(e)(*e.args) reproduce the instance, which is how pickle, copy.deepcopy, warnings.warn(text, category) and pytest-xdist all rebuild one. Section 3.3.1 of SMONITOR_GUIDE.md explains the failure it prevents.

Raise sites do not pass message. They pass typed fields, and the catalog template renders the sentence: a message handed over here is used verbatim and the template is bypassed entirely, which is what used to happen and why four of the templates had never rendered for a user.

raise DigestTypeError(context=ctx, detail=f”Expected int, got {type(v).__name__}.”)

detail is the specific fact the raise site knows and the catalog cannot: the framing around it belongs to the template.

Parameters:
  • message (str | None)

  • context (Context | None)

  • detail (str | None)

  • code (str | None)

  • fields (object)