Change-Id: Ib0c6fddd38f594d735feadce31e4809e7a4c5d44
This commit is contained in:
Enrico Faulhaber
2017-09-11 11:25:36 +02:00
parent dc891466cb
commit b26b64032e
8 changed files with 375 additions and 36 deletions

View File

@ -548,7 +548,12 @@ def get_datatype(json):
if json is None:
return json
if not isinstance(json, list):
raise ValueError('Argument must be a properly formatted list!')
import mlzlog
mlzlog.getLogger('datatypes').warning(
"WARNING: invalid datatype specified! trying fallback mechanism. ymmv!")
return get_datatype([json])
raise ValueError(
'Can not interpret datatype %r, it should be a list!', json)
if len(json) < 1:
raise ValueError('can not validate %r', json)
base = json[0]
@ -563,5 +568,5 @@ def get_datatype(json):
try:
return DATATYPES[base](*args)
except (TypeError, AttributeError) as exc:
raise ValueError('Invalid datatype descriptor')
raise ValueError('can not validate %r', json)
raise ValueError('Invalid datatype descriptor in %r', json)
raise ValueError('can not convert %r to datatype', json)