CustomUndefinedUnitError
¶
CustomUndefinedUnitError(unit_names: str | Iterable[str])
Bases: UndefinedUnitError
Custom message for undefined unit errors.
This custom error is raised when a unit is not defined in the unit registry. It provides more specific error messages, especially for currency units that are missing the currency year.
Parameters:
-
unit_names(list of str) –The names of the units that are not defined in the unit registry.
Attributes:
-
unit_names(list of str) –The names of the units that are not defined in the unit registry.
Notes
This error is a subclass of pint.errors.UndefinedUnitError and is designed
to provide more specific error messages for currency units that are missing
the currency year.
This constructor creates a new CustomUndefinedUnitError object,
inheriting all default behaviors from pint.errors.UndefinedUnitError.
Parameters:
-
unit_names(str or iterable of str) –The name or names of the undefined units that caused the error.
Methods:
-
__str__–Generate a custom error message string.
__str__
¶
__str__() -> str
Generate a custom error message string.
This method generates a custom error message string based on the unit names that are not defined in the unit registry. It provides specific messages for currency units that are missing the currency year.
Returns:
-
str–The custom error message string.