Skip to content

Commit 23ba856

Browse files
cbeauchesnerobertomonteromiguel
authored andcommitted
Do not raise an internal error on deserialization error on 500 responses (#4285)
1 parent 2628f1a commit 23ba856

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

utils/proxy/_deserializer.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,16 @@ def deserialize(data, key, content, interface, export_content_files_to: str):
331331
data["path"], data[key], content, interface, key, export_content_files_to
332332
)
333333
except:
334-
logger.exception(f"Error while deserializing {data['log_filename']}")
335-
data[key]["raw_content"] = str(content)
336-
data[key]["traceback"] = str(traceback.format_exc())
334+
if key == "response" and data[key]["status_code"] == 500:
335+
# backend may respond 500, while giving application/x-protobuf as content-type
336+
# deserialize_http_message() will fail, but it cannot be considered as an
337+
# internal error, we only log it, and do not store anything in traceback
338+
logger.exception(f"Error 500 in response in {data['log_filename']}, preventing deserialization")
339+
data[key]["content"] = str(content)
340+
else:
341+
logger.exception(f"Error while deserializing {key} in {data['log_filename']}")
342+
data[key]["raw_content"] = str(content)
343+
data[key]["traceback"] = str(traceback.format_exc())
337344

338345

339346
# if __name__ == "__main__":

0 commit comments

Comments
 (0)