Report objects when raising type error (#1554)
Give better error report when replacing non-hy objects
This commit is contained in:
parent
d4936c29ae
commit
af89fd68b0
@ -40,7 +40,7 @@ class HyObject(object):
|
|||||||
if not hasattr(self, attr) and hasattr(other, attr):
|
if not hasattr(self, attr) and hasattr(other, attr):
|
||||||
setattr(self, attr, getattr(other, attr))
|
setattr(self, attr, getattr(other, attr))
|
||||||
else:
|
else:
|
||||||
raise TypeError("Can't replace a non Hy object with a Hy object")
|
raise TypeError("Can't replace a non Hy object '{}' with a Hy object '{}'".format(repr(other), repr(self)))
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user