Skip to content

Commit

Permalink
protocols/pyon: improve error reporting of non-serializable type
Browse files Browse the repository at this point in the history
sbourdeauducq committed Oct 29, 2015
1 parent 32c95f2 commit f0eed11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion artiq/protocols/pyon.py
Original file line number Diff line number Diff line change
@@ -132,7 +132,10 @@ def encode_npscalar(self, x):
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):

0 comments on commit f0eed11

Please sign in to comment.