diff --git a/artiq/protocols/pyon.py b/artiq/protocols/pyon.py index 5c25e882c..ee50af99f 100644 --- a/artiq/protocols/pyon.py +++ b/artiq/protocols/pyon.py @@ -132,7 +132,10 @@ class _Encoder: return r def encode(self, x): - return getattr(self, "encode_" + _encode_map[type(x)])(x) + ty = _encode_map.get(type(x), None) + if ty is None: + raise TypeError(repr(x) + " is not PYON serializable") + return getattr(self, "encode_" + ty)(x) def encode(x, pretty=False):