Skip to content

Commit

Permalink
Merge pull request #424 from lsst/tickets/DM-27427
Browse files Browse the repository at this point in the history
DM-27427: Raise an exception if trying to find datasets but we know we'll fail.
  • Loading branch information
TallJimbo committed Nov 4, 2020
2 parents ee1039a + 1ee17f6 commit c4bbe20
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/daf/butler/registry/queries/_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,14 @@ def findDatasets(self, datasetType: Union[DatasetType, str], collections: Any, *
components = [componentName]
else:
components = [None]
builder.joinDataset(datasetType, collections=collections, findFirst=findFirst)
if not builder.joinDataset(datasetType, collections=collections, findFirst=findFirst):
raise RuntimeError(
f"Error finding datasets of type {datasetType.name} in collections {collections}; "
"it is impossible for any such datasets to be found in any of those collections, "
"most likely because the dataset type is not registered. "
"This error may become a successful query that returns no results in the future, "
"because queries with no results are not usually considered an error."
)
query = builder.finish(joinMissing=False)
return ParentDatasetQueryResults(db=self._db, query=query, components=components,
records=self._records)
Expand Down

0 comments on commit c4bbe20

Please sign in to comment.