From a8a58dd596e04a0b68d4be9e3fbb25bfed1ad9ff Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Sun, 15 Dec 2024 21:24:02 +0100 Subject: [PATCH] Improved error message --- fin_defs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fin_defs/__init__.py b/fin_defs/__init__.py index b6f9e42..6f8286e 100644 --- a/fin_defs/__init__.py +++ b/fin_defs/__init__.py @@ -574,7 +574,7 @@ class AssetAmount: def __truediv__(self, other: 'Decimal | AssetAmount') -> 'Decimal | AssetAmount': if isinstance(other, AssetAmount): if self.asset != other.asset: - msg = f'AssetAmount must have same asset, but: {self.asset} != {other.asset}' + msg = f'Attempting to divide {self} by {other}, but these must have the same asset' raise ValueError(msg) return self.amount / other.amount return AssetAmount(self.asset, self.amount / other)