From af89fd68b0d3ed8f97ba2ab0f1a5868b82818b94 Mon Sep 17 00:00:00 2001 From: Tuukka Turto Date: Thu, 29 Mar 2018 05:45:49 +0300 Subject: [PATCH] Report objects when raising type error (#1554) Give better error report when replacing non-hy objects --- hy/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hy/models.py b/hy/models.py index 35ff55a..cef2fe8 100644 --- a/hy/models.py +++ b/hy/models.py @@ -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