Skip to content

Commit 0afc514

Browse files
authored
fix: sanitize only the response phrase (#63)
1 parent b71687a commit 0afc514

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/sagemaker_inference/transformer.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ def handle_error(context, inference_exception, trace):
8585
Returns:
8686
str: The error message and stacktrace from the exception.
8787
"""
88-
phrase = utils.remove_crlf(inference_exception.phrase)
89-
message = utils.remove_crlf(inference_exception.message)
90-
stack_trace = utils.remove_crlf(trace)
91-
92-
context.set_response_status(code=inference_exception.status_code, phrase=phrase)
93-
return ["{} {}".format(message, stack_trace)]
88+
context.set_response_status(
89+
code=inference_exception.status_code,
90+
phrase=utils.remove_crlf(inference_exception.phrase),
91+
)
92+
return ["{}\n{}".format(inference_exception.message, trace)]
9493

9594
def transform(self, data, context):
9695
"""Take a request with input data, deserialize it, make a prediction, and return a

0 commit comments

Comments
 (0)