Skip to content

Commit 1f582dc

Browse files
committed
fix: raise exception on model loading error
1 parent 53eab8a commit 1f582dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

deepaas/model/v2/wrapper.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ def __init__(self, name, model_obj):
120120
self.has_schema = False
121121

122122
# Now convert to pydantic schema...
123-
# FIXME(aloga): use try except
124123
if schema is not None:
125-
self.response_schema = utils.pydantic_from_marshmallow(
126-
"ModelPredictionResponse", schema
127-
)
124+
try:
125+
self.response_schema = utils.pydantic_from_marshmallow(
126+
"ModelPredictionResponse", schema
127+
)
128+
except Exception as e:
129+
LOG.exception(e)
130+
raise exceptions.ModelResponseValidationError()
128131
else:
129132
self.response_schema = None
130133

0 commit comments

Comments
 (0)