Improved error message
This commit is contained in:
parent
3b50e0ecf0
commit
a8a58dd596
|
@ -574,7 +574,7 @@ class AssetAmount:
|
||||||
def __truediv__(self, other: 'Decimal | AssetAmount') -> 'Decimal | AssetAmount':
|
def __truediv__(self, other: 'Decimal | AssetAmount') -> 'Decimal | AssetAmount':
|
||||||
if isinstance(other, AssetAmount):
|
if isinstance(other, AssetAmount):
|
||||||
if self.asset != other.asset:
|
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)
|
raise ValueError(msg)
|
||||||
return self.amount / other.amount
|
return self.amount / other.amount
|
||||||
return AssetAmount(self.asset, self.amount / other)
|
return AssetAmount(self.asset, self.amount / other)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user