Skip to content

Commit

Permalink
chore: improve error message for finding reports (#396)
Browse files Browse the repository at this point in the history
also runs `make lint`
  • Loading branch information
joseph-sentry authored Mar 8, 2024
1 parent ced5094 commit ccf8612
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions codecov_cli/services/upload/upload_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ def generate_upload_data(self, report_type="coverage") -> UploadCollectionResult
files = self.file_finder.find_files()
logger.info(f"Found {len(files)} {report_type} files to upload")
if not files:
if report_type == "test_results":
error_message = "No JUnit XML reports found. Please review our documentation (https://docs.codecov.com/docs/test-result-ingestion-beta) to generate and upload the file."
else:
error_message = "No coverage reports found. Please make sure you're generating reports successfully."
raise click.ClickException(
click.style(
f"No {report_type} reports found. Please make sure you're generating reports successfully.",
error_message,
fg="red",
)
)
Expand All @@ -164,7 +168,9 @@ def generate_upload_data(self, report_type="coverage") -> UploadCollectionResult
return UploadCollectionResult(
network=network,
files=files,
file_fixes=self._produce_file_fixes_for_network(network)
if report_type == "coverage"
else [],
file_fixes=(
self._produce_file_fixes_for_network(network)
if report_type == "coverage"
else []
),
)

0 comments on commit ccf8612

Please sign in to comment.