From 131747babd1eb495a80bb4d6e534cc605aded383 Mon Sep 17 00:00:00 2001 From: Daisuke Taniwaki Date: Wed, 14 Aug 2019 19:21:39 +0900 Subject: [PATCH] Improve error handling --- python/seldon_core/seldon_methods.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/python/seldon_core/seldon_methods.py b/python/seldon_core/seldon_methods.py index 260de0e239..e20648e8bf 100644 --- a/python/seldon_core/seldon_methods.py +++ b/python/seldon_core/seldon_methods.py @@ -37,15 +37,19 @@ def predict( try: return user_model.predict_raw(request) except (NotImplementedError, AttributeError): - if is_proto: - (features, meta, datadef, data_type) = extract_request_parts(request) - client_response = client_predict(user_model, features, datadef.names, meta=meta) - return construct_response(user_model, False, request, client_response) - else: - (features, meta, datadef, data_type) = extract_request_parts_json(request) - client_response = client_predict(user_model, features, datadef.names, meta=meta) - print(client_response) - return construct_response_json(user_model, False, request, client_response) + pass + except e: + raise e + + if is_proto: + (features, meta, datadef, data_type) = extract_request_parts(request) + client_response = client_predict(user_model, features, datadef.names, meta=meta) + return construct_response(user_model, False, request, client_response) + else: + (features, meta, datadef, data_type) = extract_request_parts_json(request) + client_response = client_predict(user_model, features, datadef.names, meta=meta) + print(client_response) + return construct_response_json(user_model, False, request, client_response) def send_feedback(user_model: Any, request: prediction_pb2.Feedback,