better error info

This commit is contained in:
Michael Genson
2026-02-22 17:32:26 +00:00
parent fedd1d9eb6
commit 48cdf27ea9

View File

@@ -60,7 +60,7 @@ class UnitConverter:
return self.ureg(unit).units
except Exception as e:
if strict:
raise UnitNotFound() from e
raise UnitNotFound(f"Unit '{unit}' not found in unit registry") from e
return unit
def can_convert(self, unit: str | Unit, to_unit: str | Unit) -> bool: