Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 872d89b

Browse files
authored
fix: Snakify error code in upload errors (#1073)
1 parent e47c13a commit 872d89b

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

services/test_results.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,16 @@ def messagify_flake(
245245

246246

247247
def specific_error_message(upload_error: UploadError) -> str:
248-
title = f"### :x: {upload_error.error_code}"
249-
if upload_error.error_code == "Unsupported file format":
248+
title = f"### :x: {upload_error.error_code.replace('_', ' ').capitalize()}"
249+
if upload_error.error_code == "unsupported_file_format":
250250
description = "\n".join(
251251
[
252252
"Upload processing failed due to unsupported file format. Please review the parser error message:",
253253
f"`{upload_error.error_params['error_message']}`",
254254
"For more help, visit our [troubleshooting guide](https://docs.codecov.com/docs/test-analytics#troubleshooting).",
255255
]
256256
)
257-
elif upload_error.error_code == "File not found":
257+
elif upload_error.error_code == "file_not_in_storage":
258258
description = "\n".join(
259259
[
260260
"No result to display due to the CLI not being able to find the file.",

services/tests/test_test_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def test_specific_error_message(mocker):
279279
upload = UploadFactory()
280280
error = UploadError(
281281
report_upload=upload,
282-
error_code="Unsupported file format",
282+
error_code="unsupported_file_format",
283283
error_params={
284284
"error_message": "Error parsing JUnit XML in test.xml at 4:32: ParserError: No name found"
285285
},

tasks/ta_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def process_individual_upload(
9595
upload.state = "v2_processed"
9696
new_upload_error = UploadError(
9797
upload_id=upload.id,
98-
error_code="File not found",
98+
error_code="file_not_in_storage",
9999
error_params={},
100100
)
101101
db_session.add(new_upload_error)
@@ -120,7 +120,7 @@ def process_individual_upload(
120120
upload.state = "v2_processed"
121121
new_upload_error = UploadError(
122122
upload_id=upload.id,
123-
error_code="Unsupported file format",
123+
error_code="unsupported_file_format",
124124
error_params={"error_message": str(exc)},
125125
)
126126
db_session.add(new_upload_error)

0 commit comments

Comments
 (0)