raise exception if fraction can't be build
This commit is contained in:
parent
fcee4a8942
commit
9dd42d2151
@ -24,6 +24,8 @@ class Fraction(Explicable):
|
|||||||
"""
|
"""
|
||||||
super(Fraction, self).__init__()
|
super(Fraction, self).__init__()
|
||||||
self._num = num
|
self._num = num
|
||||||
|
if denom == 0:
|
||||||
|
raise ZeroDivisionError("Can't create Fraction: division by zero")
|
||||||
self._denom = denom
|
self._denom = denom
|
||||||
|
|
||||||
self.isNumber = 1
|
self.isNumber = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user