More useful exception when unexpected output encountered from a kitten
This commit is contained in:
parent
d689c21283
commit
0c88e11cd7
@ -76,8 +76,11 @@ def launch(args):
|
|||||||
def deserialize(output):
|
def deserialize(output):
|
||||||
import json
|
import json
|
||||||
if output.startswith('OK: '):
|
if output.startswith('OK: '):
|
||||||
prefix, sz, rest = output.split(' ', 2)
|
try:
|
||||||
return json.loads(rest[:int(sz)])
|
prefix, sz, rest = output.split(' ', 2)
|
||||||
|
return json.loads(rest[:int(sz)])
|
||||||
|
except Exception:
|
||||||
|
raise ValueError('Failed to parse kitten output: {!r}'.format(output))
|
||||||
|
|
||||||
|
|
||||||
def run_kitten(kitten, run_name='__main__'):
|
def run_kitten(kitten, run_name='__main__'):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user