forked from M-Labs/artiq
protocols/pyon: improve error reporting of non-serializable type
This commit is contained in:
parent
32c95f24d0
commit
f0eed1182a
@ -132,7 +132,10 @@ class _Encoder:
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
def encode(self, x):
|
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):
|
def encode(x, pretty=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user