Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handled error to return the reason of failure as part of the response. #1013

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shamika
Copy link

@shamika shamika commented Mar 7, 2023

Before or while filing an issue please feel free to join our slack channel to get in touch with development team, ask questions, find out what's cooking and more!

Issue #, if available:

Description of changes:

Caught the exception of the invoking entry point and returned the failure as part of the response

Testing done: Yes (Ran the CI tests and all passed. )

To run CI tests on your changes refer README.md

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

logger.warning("Invoking custom service failed.", exc_info=True)
return create_predict_response(None, req_id_map, "Prediction failed", 503)
return create_predict_response(None, req_id_map, "Prediction failed : [{}]".format(e), 503)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is bad practice to return exception details to client for unknown generic exceptions, as it can expose sensitive implementation details.

It would be fine to log the original exception though when wrapping in generic message.

Even without patch, the model code can use mms.PredictionException to preserve error code and message (see line 109 just a few lines above this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants