Skip to content

Commit

Permalink
update error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
avrohomgottlieb committed Dec 6, 2024
1 parent faf9636 commit a8d0b0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions api/scpca_portal/models/computed_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def get_project_file(cls, project, download_config: Dict) -> Self | None:
libraries = project.get_libraries(download_config)
# If the query returns empty, then throw an error occurred.
if not libraries.exists():
raise ValueError(
"Invalid request: no libraries exist with this project-download_config combination."
)
raise ValueError("Unable to find libraries for download_config.")

libraries_metadata = [
lib_md for library in libraries for lib_md in library.get_combined_library_metadata()
Expand Down Expand Up @@ -230,9 +228,7 @@ def get_sample_file(cls, sample, download_config: Dict) -> Self | None:
libraries = sample.get_libraries(download_config)
# If the query returns empty, then throw an error occurred.
if not libraries.exists():
raise ValueError(
"Invalid request: no libraries exist with this sample-download_config combination."
)
raise ValueError("Unable to find libraries for download_config.")

libraries_metadata = [
lib_md for library in libraries for lib_md in library.get_combined_library_metadata()
Expand Down
2 changes: 1 addition & 1 deletion api/scpca_portal/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def get_libraries(self, download_config: Dict = {}): # -> QuerySet[Library]:
return self.libraries.all()

if download_config not in common.PROJECT_DOWNLOAD_CONFIGS.values():
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.")
raise ValueError("Invalid download_config passed. Unable to retrieve libraries.")

# You cannot include multiplexed when there are no multiplexed libraries
if not download_config["excludes_multiplexed"] and not self.has_multiplexed_data:
Expand Down
2 changes: 1 addition & 1 deletion api/scpca_portal/models/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_libraries(self, download_config: Dict = {}): # -> QuerySet[Library]:
return self.libraries.all()

if download_config not in common.SAMPLE_DOWNLOAD_CONFIGS.values():
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.")
raise ValueError("Invalid download_config passed. Unable to retrieve libraries.")

return self.libraries.filter(
modality=download_config["modality"],
Expand Down

0 comments on commit a8d0b0a

Please sign in to comment.