Skip to content

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.

except Exception as e: # pylint: disable=broad-except
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