Skip to content

Commit

Permalink
exception without the try/catch block
Browse files Browse the repository at this point in the history
Also, improve clarity a bit...
  • Loading branch information
ahmedhamidawan committed Mar 17, 2024
1 parent b84f945 commit d6914b7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/galaxy/webapps/galaxy/services/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@ def _data(

extra_info = None
mode = kwargs.get("mode", "Auto")
indexer = None

# Coverage mode uses index data.
if mode == "Coverage":
Expand Down Expand Up @@ -928,8 +927,7 @@ def _data(
)

# Get mean depth.
if not indexer:
indexer = self._get_indexer(trans, dataset)
indexer = self._get_indexer(trans, dataset)
stats = indexer.get_data(chrom, low, high, stats=True)
mean_depth = stats["data"]["mean"]

Expand Down Expand Up @@ -983,10 +981,9 @@ def _raw_data(
return data

def _get_indexer(self, trans, dataset):
try:
indexer = self.data_provider_registry.get_data_provider(trans, original_dataset=dataset, source="index")
if indexer is None:
raise Exception("No indexer available for this dataset")
return indexer
except Exception as e:
raise galaxy_exceptions.ObjectNotFound(f"Error getting indexer: {util.unicodify(e)}")
indexer = self.data_provider_registry.get_data_provider(trans, original_dataset=dataset, source="index")
if indexer is None:
msg = f"No indexer available for dataset {self.encode_id(dataset.id)}"
log.exception(msg)
raise galaxy_exceptions.ObjectNotFound(msg)
return indexer

0 comments on commit d6914b7

Please sign in to comment.