def validate(schema, data):
"""
A wrapper around the call to voluptuous schema to raise the proper exception.
Args:
schema: The voluptuous Schema object
data: The validation data for the schema object
Raises:
APIException with status 0 and the voluptuous error message
"""
try:
schema(data)
except MultipleInvalid as error:
raise APIException(0, None, error.msg)
评论列表
文章目录