goalie.CheckError

exception goalie.CheckError(value: object, expected: str, name: str | None = None)

Bases: Exception

A goalie check failed.

Parameters:
  • value (object) – Value that failed the check.

  • expected (str) – Noun phrase describing what was expected, such as "a non-empty string".

  • name (str | None) – Name of the argument or variable that holds value.

Examples

>>> str(CheckError(1, "a string"))
'Expected a string, got 1.'
>>> str(CheckError(1, "a string", name="prefix"))
'prefix must be a string, got 1.'