Report objects when raising type error (#1554)

Give better error report when replacing non-hy objects
This commit is contained in:
Tuukka Turto 2018-03-29 05:45:49 +03:00 committed by Ryan Gonzalez
parent d4936c29ae
commit af89fd68b0

View File

@ -40,7 +40,7 @@ class HyObject(object):
if not hasattr(self, attr) and hasattr(other, attr):
setattr(self, attr, getattr(other, attr))
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